• 1
name Punditsdkoslkdosdkoskdo

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

Where is it acceptable to put css folders and image file folders? I was thinking inside the view folder? However the controller always reroutes the path to the base url so I have to specify the path in the .html file to where it sits, which is redundant.

  • 1

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:


function asset_url(){
   return base_url().'assets/';

I will usually keep common routines similar to this in the same file and autoload it with codeigniter's autoload configuration.

Note: autoload URL helper for base_url() access.


$autoload['helper'] = array('url','utility');

You will then have access to asset_url() throughout your code.

  • 1
Reply Report

Related Questions

Trending Tags