What is the best way to put scripts on pages?

Sorry… I’m still a newbie. What is the best way to put scripts on pages?

Hello,

if you mean javascript then:

registerScript / registerScriptFile

http://www.yiiframework.com/doc/api/CClientScript#registerScript

You can use it in this way:


Yii::app()->clientScript->registerScriptFile(...)

bye,

Giovanni.

Generally I do it like this:


$script = <<<EOD

Javascript here with $vars if I like

EOD;

Yii::app()->clientScript->registerScript('someId', $script, CClientScript::POS_READY);