Skip to content

Instantly share code, notes, and snippets.

@albertomario
Created January 16, 2018 20:45
Show Gist options
  • Save albertomario/d7b4605e1bd80941e8b12d1b14d61e01 to your computer and use it in GitHub Desktop.
Save albertomario/d7b4605e1bd80941e8b12d1b14d61e01 to your computer and use it in GitHub Desktop.
codeigniter template helper
<?php
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);
endif;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment