I have a big project using 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
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. And my js functions are not working at all.
I want files in this directory
/webroot/js/signaturepad
start paths without slash '/' and 'js' folder name, like:
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
If you want use other folder inside webroot folder, for example: 'frontend' then start path with slash '/'.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.