I’m working with cakephp 2.0 and would like to use different css for each views.
Do you know the way of changing the result of the command $this->fetch(‘css’) in the default.ctp template?
<?php
var_dump ($this->fetch('css')) ;
?>
gives
string(0) ""
I found http://book.cakephp.org/1.3/view/1437/css in the cookbook but this is of no interest, since the < link rel=”stylesheet” type=”text/css” href=”/css/forms.css” / > tag is only located in the < header > section and that my view templates does not have the < header > section in it.
An other kind of answers is to use an array as view parameter and to change consequently the default.ctp which parse this css files array. But is this kind of helper already included in the base cakephp2.0?
Thank for any answer.
Simply use HtmlHelper::css() in the views to add CSS files as you need. Use inline => true to make it inline if you do not want to have it in the header.