Welcome Guest, Not a member yet? Register   Sign In
Hooks don't work
#1

[eluser]CoderReborn[/eluser]
I'm trying to use hooks to implement standard headers/footers on every page.


In my config file, I turned on hooks: $config['enable_hooks'] = TRUE;

Here's my hooks.php file:
Code:
$hook['pre_controller'] = array(
                      'class'  => 'Template',
                      'function' => 'header',
                      'filename' => 'template.php',
                      'filepath' => 'hooks'
                      );



$hook['post_controller'] = array(
                      'class'  => 'Template',
                      'function' => 'footer',
                      'filename' => 'template.php',
                      'filepath' => 'hooks'
                      );

Here's my template.php file:
Code:
<?php

/* Hook template functions */


class Template
{
    public function header()
    {
        $local_CI =& get_instance();
        $local_CI->load->view('header_view');
    }

    public function footer()
    {
        $local_CI =& get_instance();
        $local_CI->load->view('footer_view');
    }

}
?>

But when I run a test controller, I just get a HTTP 500 error code.
When I run the test controller without the hooks enabled, it works fine.

Do my header_view.php and footer_view.php files need to formatted in a special way?
Are there any restriction on what can/cannot be included in them as hook files?
They are just static HTML files now.


Thanks for your help!


Messages In This Thread
Hooks don't work - by El Forum - 06-08-2010, 12:27 PM
Hooks don't work - by El Forum - 06-08-2010, 02:30 PM
Hooks don't work - by El Forum - 06-08-2010, 03:28 PM
Hooks don't work - by El Forum - 06-08-2010, 10:48 PM
Hooks don't work - by El Forum - 06-09-2010, 12:42 AM
Hooks don't work - by El Forum - 06-09-2010, 02:03 AM
Hooks don't work - by El Forum - 06-09-2010, 12:34 PM
Hooks don't work - by El Forum - 06-09-2010, 01:05 PM
Hooks don't work - by El Forum - 06-09-2010, 01:47 PM
Hooks don't work - by El Forum - 06-22-2010, 09:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB