[英]CakePHP - Web page try to load all the js files in the webroot
I have a big project using CakePHP. 我有一个使用CakePHP的大型项目。 I have a web page and I only want it to load the js files in a subfolder of webroot
but it seems like loading all the js files in the webroot
我有一个网页,我只希望它将js文件加载到webroot
的子文件夹中,但似乎加载了webroot
所有js文件
I want files in this directory 我想要此目录中的文件
/webroot/js/signaturepad
and in my code I wrote: 在我的代码中,我写道:
echo $this->Html->script(array(
'/js/signaturepad/TopazSignature',
'/js/signaturepad/SigWebTablet'
), array('inline' => false));
So it supposes to read these two js files only while in the page source I can see tons of js files in the webroot been loaded. 因此,它假定仅在页面源中可以看到加载了Webroot中大量js文件的同时读取这两个js文件。 And my js functions are not working at all. 而且我的js函数根本不起作用。
I want files in this directory 我想要此目录中的文件
/webroot/js/signaturepad / webroot / js / signaturepad
start paths without slash '/' and 'js' folder name, like: 起始路径不带斜杠“ /”和“ js”文件夹名称,例如:
echo $this->Html->script(array(
'subfolder/your_js_file_name_here',
'subfolder/your_js_file_name_here.min'
), array('inline' => false));
This generate path like example.com/js/subfolder/your_js_file_name_here.js
这会生成类似example.com/js/subfolder/your_js_file_name_here.js
路径
If you want use other folder inside webroot folder, for example: 'frontend' then start path with slash '/'. 如果要在webroot文件夹中使用其他文件夹,例如:'frontend',则以斜杠'/'开头。
echo $this->Html->script(array(
'/frontend/your_js_file_name_here',
'/forntend/your_js_file_name_here.min'
), array('inline' => false));
This generate path like example.com/frontend/your_js_file_name_here.js
这会生成类似example.com/frontend/your_js_file_name_here.js
路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.