CakePHP - how to link html css helper to a different folder

邮差的信 提交于 2019-12-22 17:41:12

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!