linking to CSS and JS files - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: linking to CSS and JS files (/showthread.php?tid=55847) |
linking to CSS and JS files - El Forum - 11-12-2012 [eluser]imdevin567[/eluser] This is quite an elementary concept, but I'm new to CodeIgniter (and MVC in general) and I cannot for the life of me figure this out. I am using the templates library to create a skeleton template for the rest of my pages. I am having no problem loading the template from the controller, but my javascript and CSS files in my template are just not linking to the right place. I have tried placing the files in the view folder, outside of the application folder...and elsewhere. Firebug is telling me that the files cannot be found. I did use mod_rewrite to make clean URLS--not sure if this makes a difference in linking to internal files...here is what I have. Code: <$cript src="<?php echo base_url(); ?>templates/responsive/plugins/vegas/jquery.vegas.js" type="text/javascript"></$cript> Any reason why this file is not found? linking to CSS and JS files - El Forum - 11-12-2012 [eluser]xeroblast[/eluser] try: Code: <$cript src="<?php echo base_url( 'templates/responsive/plugins/vegas/jquery.vegas.js' ); ?>" type="text/javascript"></$cript> linking to CSS and JS files - El Forum - 11-12-2012 [eluser]imdevin567[/eluser] Still pulling up a 404 for the script file. The URL is showing up properly, but the file is not being found... This is happening when I try to include any sort of file--so the issue is in my URLs or file structure. Right now I have my base_url() pointing to localhost/web. Here is my file structure thus far: localhost -web --application --system --templates --index.php Any reason this is happening? linking to CSS and JS files - El Forum - 11-12-2012 [eluser]xeroblast[/eluser] file and folder permissions? linking to CSS and JS files - El Forum - 11-12-2012 [eluser]imdevin567[/eluser] Just tested a separate folder on localhost without CI and there were no issues linking. So it's not a file permissions issue. linking to CSS and JS files - El Forum - 11-12-2012 [eluser]imdevin567[/eluser] It's an htaccess issue. Since I used mod_rewrite I needed to add the templates folder in my RewriteRule. Solved with Code: RewriteCond $1 !^(index\.php|robots\.txt|templates) |