Let’s say all my pages use the same layout templates. Once in a while, for some specific controller/actions I want my HTML <header> to have some extra code (extra css, javascript, meta …).
What’s the conventional way to achieve this?
Let’s say all my pages use the same layout templates. Once in a while, for some specific controller/actions I want my HTML <header> to have some extra code (extra css, javascript, meta …).
What’s the conventional way to achieve this?
You can use the methods from CClientScript.registerX in the controller action:
registerMetaTag
registerCssFile
registerScriptFile
…
function actionXY()
{
...
Yii::app()->clientScript->registerMetaTag(....);
Yii::app()->clientScript->registerScriptFile($scriptUrl,CClientScript::POS_HEAD);
...
$this->render(...);
}