CodeIgniter Forums
Help regarding the path variable - 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: Help regarding the path variable (/showthread.php?tid=33334)



Help regarding the path variable - El Forum - 08-23-2010

[eluser]oldrock[/eluser]
hi ,

could anybody please let me know is there any variable availble for getting the path for current page.

The purpose is to link to the css file on all the pages of my website


thamks n advance


Help regarding the path variable - El Forum - 08-23-2010

[eluser]WanWizard[/eluser]
Have you checked the URI class (see the user guide )?

You shouldn't make a css file (or any asset) dependent on the page URI. It is best practice to have all assets in a folder called 'assets' in the root of your website (and then sub folders per type).
Assets are then references using
Code:
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/mycssfile.css" type="text/css" media="screen"/>

Don't forget to configure your base_url and index file in config/config.php.