-
Notifications
You must be signed in to change notification settings - Fork 4
Chuck Son's take
Using Hooks for headers and footers is much more flexible than using a master template. A master template requires you to pass all possible rendered view outputs to its "contents" argument, while Hooks will simply sandwiches any and all possible views before appending the footer. Hooks are particularly helpful when modifying a library such as "Tank Auth" that has 5+ views you'd otherwise have to individually pass as arguments to your master template.
./config/hooks.php:
$hook['post_controller'] = array( 'class' => 'Template', 'function' => 'footer', 'filename' => 'template.php', 'filepath' => 'hooks' );
./hooks/template.php:
class Template extends Controller { function Template() { parent::Controller(); }
function footer() {
$this->load->view('footer_view');
}
}
Also make sure to have the Hooks field set to TRUE in your master config file.