summaryrefslogtreecommitdiffstats
path: root/system/libraries/Controller.php
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-28 09:45:59 +0200
committeradmin <devnull@localhost>2006-09-28 09:45:59 +0200
commit4ce59da7905eca21a6cc3be04adfbcab672a9969 (patch)
tree10dd27a8e0d01e3fd39e1c250104c67848e40dcf /system/libraries/Controller.php
parent79c643da4efcf154254730d78c6532cff3d99d1e (diff)
Diffstat (limited to 'system/libraries/Controller.php')
-rw-r--r--system/libraries/Controller.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php
index aa7b87b00..f00a7262b 100644
--- a/system/libraries/Controller.php
+++ b/system/libraries/Controller.php
@@ -219,6 +219,20 @@ class Controller extends CI_Base {
*/
function _ci_init_model($model, $name = '', $db_conn = FALSE)
{
+ // Is the model in a sub-folder?
+ // If so, parse out the filename and path.
+ if (strpos($model, '/') === FALSE)
+ {
+ $path = '';
+ }
+ else
+ {
+ $x = explode('/', $model);
+ $model = end($x);
+ unset($x[count($x)-1]);
+ $path = implode('/', $x).'/';
+ }
+
if ($name == '')
{
$name = $model;
@@ -237,11 +251,11 @@ class Controller extends CI_Base {
$model = strtolower($model);
- if ( ! file_exists(APPPATH.'models/'.$model.EXT))
+ if ( ! file_exists(APPPATH.'models/'.$path.$model.EXT))
{
show_error('Unable to locate the model you have specified: '.$model);
}
-
+
if ($db_conn !== FALSE)
{
if ($db_conn === TRUE)
@@ -255,7 +269,7 @@ class Controller extends CI_Base {
require_once(BASEPATH.'libraries/Model'.EXT);
}
- require_once(APPPATH.'models/'.$model.EXT);
+ require_once(APPPATH.'models/'.$path.$model.EXT);
$model = ucfirst($model);
$this->$name = new $model();