CodeIgniter Forums
Calling a function after controller method - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Calling a function after controller method (/thread-3712.html)

Calling a function after controller method - El Forum - 10-18-2007

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