Created
January 14, 2012 12:06
-
-
Save phawk/1611188 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 | |
class MY_Controller extends CI_Controller | |
{ | |
public $data = array(); // Array to store data - passed to views. | |
protected $view_path = null; // Here to overide the view path if needed. | |
protected function __construct() | |
{ | |
parent::__construct(); | |
} | |
protected function render() | |
{ | |
if( is_null( $this->view_path ) ) | |
{ | |
$view_uri = $this->router->fetch_class() . '/' . $this->router->fetch_method(); | |
} | |
else | |
{ | |
$view_uri = $this->view_path; | |
} | |
// Auto write the view, and pass in the data object. | |
$this->template->write_view( 'content', $view_uri, $this->data ); | |
$this->template->render(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment