CodeIgniter Forums

Full Version: File Placement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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.

El Forum

[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