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

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 it can no longer find the stylesheet. When I am viewing the root it is /welcome.

El Forum

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

To get around this, use the base_url function in the URL helper (make sure to autoload it) as follows
<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