diff options
-rw-r--r-- | application/config/config.php | 11 | ||||
-rw-r--r-- | system/core/Exceptions.php | 17 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
3 files changed, 27 insertions, 2 deletions
diff --git a/application/config/config.php b/application/config/config.php index ae89715c0..069162097 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -255,6 +255,17 @@ $config['log_date_format'] = 'Y-m-d H:i:s'; /* |-------------------------------------------------------------------------- +| Error Templates Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/views/errors/ folder. Use a full server path with trailing slash. +| +*/ +$config['error_templates_path'] = ''; + +/* +|-------------------------------------------------------------------------- | Cache Directory Path |-------------------------------------------------------------------------- | diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 041869641..398459d54 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -45,6 +45,13 @@ class CI_Exceptions { public $ob_level; /** + * Path to the error templates + * + * @var string + */ + protected $_templates_path; + + /** * List if available error levels * * @var array @@ -73,6 +80,12 @@ class CI_Exceptions { { $this->ob_level = ob_get_level(); // Note: Do not log messages from this constructor. + + $config =& get_config(); + + $this->_templates_path = (isset($config['error_templates_path']) && $config['error_templates_path'] !== '') + ? $config['error_templates_path'] + : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } // -------------------------------------------------------------------- @@ -162,7 +175,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(VIEWPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); + include($this->_templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -205,7 +218,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(VIEWPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); + include($this->_templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 9d3ceb08e..48a20ee6f 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -48,6 +48,7 @@ Release Date: Not Released - Removed previously deprecated EXT constant. - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties. - Moved error templates to *application/views/errors/*. + - Made error templates path configurable using ``$config['error_templates_path']``. - Moved the Log class to *application/core/* - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment. - Changed detection of ``$view_folder`` so that if it's not found in the current path, it will now also be searched for under the application folder. |