CodeIgniter Forums

Full Version: Calling a function after controller method
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hello Igniters,

i've been using CI for some time and to be honest i really like it. Now i use it as a base on all my application.

There has been something that i've been strugling with for a while. I want to call a method which is defined in my controller class ( extended base controller ) after every execution of a controller method. Thats because i make a lot of simple sites and i want to minimize the size of the code in there.

I know there are hooks. Using it you can execute a class method on post_controller point. You should enter there Class and method name which is not exactly what i want.. I want to be able to execute a member function of the current controller.

A possible solution might be to make a class which gets instance so it gets access to the current CI resources and execute this "destructor" but it doesnt seem quite right.

I will appreciate any suggestions!

Thanks for your time Smile
Hristo