Created
March 27, 2015 08:45
-
-
Save HelgeSverre/9caed14fb2227aaf0a90 to your computer and use it in GitHub Desktop.
Template loading function for CodeIgniter 3.x
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 | |
/** | |
* Template loading function for CodeIgniter 3.x | |
* Location: application/core/MY_Loader.php | |
* Class MY_Loader | |
*/ | |
class MY_Loader extends CI_Loader | |
{ | |
public function template($template_name, $vars = array(), $return = FALSE) | |
{ | |
if ($return) { | |
$content = $this->view('templates/header', $vars, $return); | |
$content .= $this->view($template_name, $vars, $return); | |
$content .= $this->view('templates/footer', $vars, $return); | |
return $content; | |
} else { | |
$this->view('templates/header', $vars); | |
$this->view($template_name, $vars); | |
$this->view('templates/footer', $vars); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment