Registered CSS files do not appear in HEAD

Hello,

Trying to get CSS and Javascript files to appear in the HEAD of my site template. The combination of CSS and JS files vary depending on the controller and action being called.

I’ve tried different combinations of code that I’ve found on the forums such as:




<?php


Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl.'/css/form.css');


?>



…or




<?php


$cs = Yii::app()->getClientScript();

$cs->registerCssFile(Yii::app()->baseUrl.'/css/form.css');


?>



I’ve tried putting these snippets in the action of my controller as well as directly within the head of my layout template. So far the CSS link -or- @import code has not appeared in either case in the final page output.

Any ideas what I might be doing wrong?

Thanks a lot.

Tim

Sorry, that wasn’t very clear. What I’m aiming to do is load different CSS and Javascript files depending on what controller and action is being called. So somehow within the controller and/or action I need to find a way to tack on the additional CSS & JS files I need.

Tim