Organizational Research By

Surprising Reserch Topic

Where do I put image files, css, js, etc. in Codeigniter?



asked Apr 29, 2015 in codeinither by rahulgii
0 votes
36 views



Related Hot Questions

1 Answer

0 votes
I have a setup like this:

application
system
assets
js
imgs
css
I then have a helper function that simply returns the full path to this depending on my setup.. something similar to:

application/helpers/utility_helper.php:

function asset_url(){
   return base_url().'assets/';
}
I will usually keep common routines similar to this in the same file and autoload it with codeigniters autoload configuration. Note: autoload URL helper for base_url() access.

application/config/autoload.php:

$autoload['helper'] = array('url','utility');
You will then have access to asset_url() throughout your code.
answered Apr 29, 2015 by rahulgii

...