File Placement - 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: File Placement (/showthread.php?tid=21392) |
File Placement - El Forum - 08-08-2009 [eluser]georgerobbo[/eluser] Where exactly should I place the CSS/Javascript? At the moment I have it in the root directory with index.php However when I go http://10.0.0.6/igniter/index.php/welcome it can no longer find the stylesheet. When I am viewing the root it is /welcome. File Placement - El Forum - 08-08-2009 [eluser]Dam1an[/eluser] The problem is the path is relative to the URI, although the following all take you to the same page, the relative paths are all differant / /welcome /welcome/index To get around this, use the base_url function in the URL helper (make sure to autoload it) as follows Code: <link rel="stylesheet" href="<?=base_url()?>css/reset.css" media="screen" type="text/css" /> That is assuming you have a css filder in your web root |