0
votes

I try to develop a kind of “hook” system. I want to load in my Template library some controllers functions.

So I did this function :

function hookTop() 
{
    $output = '';

    foreach ($this->_ci->config->item('hookTop') as $module) {
        $this->_ci->load->module($module);
        $output .= $this->$module->hookTop();
    }

    return $output;
} 

And I have in my config item the list of modules containing a “hookTop” function. But I have this error :

Fatal error: require(): Cannot redeclare class ci in /var/www/preprod/toolbox/application/third_party/MX/Controller.php on line 4

I am using HMVC module (version 5.4), and my controller extends MX_CONTROLLER.

Does anyone else have this error? Is this possible to do? Thanks !

1

1 Answers

0
votes

You can create only 1 controller instance on your PHP execution, if you want to call method like this, you should move these methods to model.