Welcome Guest, Not a member yet? Register   Sign In
link js file in view folder
#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


Messages In This Thread
link js file in view folder - by seasenx6 - 10-15-2015, 05:56 AM
RE: link js file in view folder - by Martin7483 - 10-15-2015, 06:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB