Business, Tech, Life, and Whatever else

CodeIgniter – Change Views Location

by Eric Barnes on July 6, 2009

This is the first post in what is going to be CodeIgniter week here at Eric Barnes. I have been using CodeIgniter a lot and thought it would be good to share some of the tips and tricks I have learned over the past few years. Now with the intro out of the way lets jump in. :)

Some people, most notably me, want to change where the view files are located in a CodeIgniter application. Here is a quick tip that I do, should you want to make the same change.

For my setup I like to have a template folder in the root to house my view files. So in order to get CodeIgniter to use this directory you have two options.

1. Is to edit system/libraries/Loader.php. Search for and change:

$this->_ci_view_path = 'templates/';

Please note that I assigned the root folder to the php include path.

2. Is a more preferred method and for it you make a copy Loader.php and make the same change above. But put the copy in your application/libraries/ folder. This is a better option because you are not altering any of the core files and upgrades will be easier later on.

Be sure and subscribe to my Feed to get the rest of the CodeIgniter tips.

You May Also Be Interested In...

Code Igniter Template Tutorial
July 7, 2008

CodeIgniter Authorization
July 10, 2009

CodeIgniter Custom Settings File
July 9, 2009

Building a news module – 68 Classifieds
July 1, 2009

Subscribe Now

If you enjoyed this post, you will definitely enjoy my others. Subscribe to the feed to get instantly updated for those awesome posts soon to come.


  • thanks. i'm gonna redesign my site. put it in the different directory will be easier than overwrite existing views.
  • I think the same as you. Views must be a top folder, or i feel depressed. :) By the way, thanks. :)
blog comments powered by Disqus