What is the best way to do and equivalent to CakePHP's beforeFilter() in codeIgniter
+4
A:
sounds like hooks might be what you're after
CakePHP beforeFilter()
This function is executed before every action in the controller. It's a handy place to check for an active session or inspect user permissions.or inspect user permissions.
CodeIgniter pre controller
Called immediately prior to any of your controllers being called. All base classes, routing, and security checks have been done.
$hook['pre_controller'] = array(
'class' => 'MyClass',
'function' => 'Myfunction',
'filename' => 'Myclass.php',
'filepath' => 'hooks',
'params' => array('beer', 'wine', 'snacks')
);
maybe?
Ross
2010-10-17 16:51:03
in application/config/config.php ensure you have $config['enable_hooks'] = TRUE;
dryprogrammers
2010-10-17 23:03:40