A function in all controlers |
[eluser]kosmosik[/eluser]
I have a block of code that I wan't to run inside every controller. It is auth/ACL functionality I don't wan't to repeat this block in each controller so where to put this code?
[eluser]Neophyte[/eluser]
you could use a pre_controller hook to have code run before every controller ?
[eluser]ontguy[/eluser]
Michael Wales has a nice suggestion for this; http://www.michaelwales.com/2008/01/my-c...-dev-pack/. There are a few posts in the forum with some examples; I can't find now so I'll just paste how I got his method working. application\libraries\MY_Controller.php Code: class Public_Controller extends Controller { application\controllers\checkout.php Code: class Checkout extends Auth_Controller { application\controllers\admin.php Code: class Admin extends Public_Controller { |
Welcome Guest, Not a member yet? Register Sign In |