Created
November 11, 2011 21:57
-
-
Save sapphiriq/1359432 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 | |
protected function display($template = FALSE, $render = TRUE) | |
{ | |
if ($template == FALSE) | |
{ | |
// Delete package namespaces (e.g., App\Controllers) | |
$name = strtolower(get_class($this)); | |
$name = implode(DS,array_slice(explode('\\', $name), 2)); | |
$action = $this->request->get_action(); | |
$tpl = APPPATH.'views'.DS.$name.DS.$action.'.php'; | |
} else { | |
$template = str_replace('/',DS, $template); | |
$tpl = APPPATH.'views'.DS.$template.'.php'; | |
} | |
if ( ! file_exists($tpl)) | |
$this->response->error500(); | |
// Render template | |
ob_start(); | |
extract($this->_params); | |
include $tpl; | |
$yield = ob_get_clean(); | |
include APPPATH.'views'.DS.'layouts'.DS.$this->layout.'.php'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment