Created
April 26, 2009 19:57
-
-
Save walesmd/102147 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// application/libraries/MY_Controller.php | |
class MY_Controller extends Controller { | |
var $partial = 'debug/echo'; | |
function MY_Controller() { | |
parent::Controller(); | |
$this->_get_partial(); | |
$this->_get_model(); | |
} | |
function _get_partial() { | |
$uri = $this->router->class . '/' . $this->router->method; | |
if (is_file(realpath(dirname(__FILE__) . '/../views/' . $uri . EXT))) { | |
$this->partial = $this->router->class . '/' . $this->router->method; | |
} | |
} | |
function _get_model() { | |
$uri = substr($this->router->class, 0, -1); | |
if (is_file(realpath(dirname(__FILE__) . '/../models/' . $uri . EXT))) { | |
$this->load->model($uri); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment