diff options
author | Joe Cianflone <joe@mileonemedia.com> | 2011-08-21 16:39:06 +0200 |
---|---|---|
committer | Joe Cianflone <joe@mileonemedia.com> | 2011-08-21 16:39:06 +0200 |
commit | 8eef9c77512d4fad5357d3cbda83b89f844d7d16 (patch) | |
tree | 3a90bf5bfa2c519932e3ed7f2f5f2479b0c027b2 | |
parent | 9c631750dfa62c748ef9cd9bccdde3250d6e5b72 (diff) |
Ability to move the view folder out of the Application directory
* index.php -- added the $view_folder var and VIEWPATH constant *
Loader.php -- changed the private _ci_view_paths var so that it's not
hardcoded to the view dir, but looks for the VIEWPATH constant instead
-rw-r--r-- | index.php | 33 | ||||
-rwxr-xr-x | system/core/Loader.php | 2 |
2 files changed, 34 insertions, 1 deletions
@@ -73,6 +73,23 @@ if (defined('ENVIRONMENT')) * */ $application_folder = 'application'; + +/* + *--------------------------------------------------------------- + * VIEW FOLDER NAME + *--------------------------------------------------------------- + * + * If you want to move the view folder out of the application + * folder set the path to the folder here. The folder can be renamed + * and relocated anywhere on your server. If blank, it will default + * to the standard location inside your application folder. If you + * do move this, use the full server path to this folder + * + * NO TRAILING SLASH! + * + */ + $view_folder = ''; + /* * -------------------------------------------------------------------- @@ -190,6 +207,22 @@ if (defined('ENVIRONMENT')) define('APPPATH', BASEPATH.$application_folder.'/'); } + + // The path to the "views" folder + if (is_dir($view_folder)) + { + define ('VIEWPATH', $view_folder .'/'); + } + else + { + if ( ! is_dir(APPPATH.'views/')) + { + exit("Your view folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF); + } + + define ('VIEWPATH', APPPATH.'views/' ); + } + /* * -------------------------------------------------------------------- diff --git a/system/core/Loader.php b/system/core/Loader.php index e7fa3d3f6..452dc0b4c 100755 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -127,7 +127,7 @@ class CI_Loader { $this->_ci_library_paths = array(APPPATH, BASEPATH); $this->_ci_helper_paths = array(APPPATH, BASEPATH); $this->_ci_model_paths = array(APPPATH); - $this->_ci_view_paths = array(APPPATH.'views/' => TRUE); + $this->_ci_view_paths = array(VIEWPATH => TRUE); log_message('debug', "Loader Class Initialized"); } |