The CSS and JS scripts should be places before the title tag, right ? (I tried without the header tag)
Also an other question, I use CclientScript to add some javascript code. It works great. But how can I use the CclientScript->registerScript() to write the javascript multilines ? Let say, I have a very long script, I don’t want to write it on a single line inside the PHP function.
The portlet I render in this view has the run function overide.
To not use the
$content=ob_get_clean();
is somehow a bas idea.
Still can I get an answer for this ?
I use CclientScript to add some javascript code. It works great. But how can I use the CclientScript->registerScript() to write the javascript multilines ? Let say, I have a very long script, I don’t want to write it on a single line inside the PHP function.
$script = <<<HTML
/* here you write your javascript normally in multiple lines */
HTML;
Yii::app()->clientScript->registerScript('someId', $script, CClientScript::POS_READY); // POS_READY is an example, please check the docs
[*]less elegant, but works as well:
Yii::app()->clientScript->registerScript("someId", "
/* here you write your javascript normally in multiple lines
but please watch out the quotes & single quotes */
", CClientScript::POS_READY); // POS_READY is an example, please check the docs