user1224233 user1224233 - 6 months ago 117
PHP Question

Codeigniter basepath system

In my view folder I putt one template and all its files but that template didn't load its css through codeigniter . Later I echo the basepath:

echo basepath;

This gives me this path:


Doesn't it show the default path to that particular folder where the file is. My assumption is that it should give this path:




You should place your css and other public assets in a folder in the site root.

For example:


Then, from inside your view, you can use:

<link rel="stylesheet" type="text/css" media="all" href="<?php echo site_url('public/css/main.css'); ?>">

Also, in application/config/config.php you change the base_url like this:

$config['base_url'] = '';

It should be on line 17 of that file.