问题
Currently I'm using using this to load in css in my CakePHP project.
echo $this->Html->css('jquery-ui',null,array('inline' => false));
That is assuming that I'm putting my css file in a css folder.
However, I'm now thinking about moving my css that is needed for js libraries to the js folder instead. (i.e in js/lib/jquery-ui.js AND js/lib/jquery-ui.css). That way I don't have to keep track of 2 folders with the same structure.
How can I change where CakePHP's css helper to point to a different folder?
Or is that not a good practice what I'm trying to do. (i.e moving the plugin css to live in the same folder as the js)
Thanks,
Tee
回答1:
From the API:
If
$path
is prefixed with '/', the path will be relative to the webroot of your application. Otherwise, the path will be relative to your CSS path
So you'd do:
echo $this->Html->css('/js/lib/jquery-ui',null,array('inline' => false));
来源:https://stackoverflow.com/questions/14370159/cakephp-how-to-link-html-css-helper-to-a-different-folder