Welcome Guest, Not a member yet? Register   Sign In
link js file in view folder
#1

(This post was last modified: 10-15-2015, 06:04 AM by seasenx6.)

IF I have js file in view folder.

And I want to know how to link js file from js file in VIEW FOLDER.

thank you.
Reply
#2

You can't do that. View directories are not available through a request URI.
So the URL for the JS file must be callable via the browser.
E.g. http://www.yourdomain.com/assets/js/your-file.js

You can use an assets directory where you store al JS/CSS and images required for use in your views.
If you are using a htaccess file to remove the index.php from your URL you can add assets to the condition so that asset urls are not routed through the index.php
Code:
#Rule for routing all page requests through index.php
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Reply




Theme © iAndrew 2016 - Forum software by © MyBB