CodeIgniter Forums
Hooks and Cache - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Hooks and Cache (/showthread.php?tid=26550)



Hooks and Cache - El Forum - 01-16-2010

[eluser]seantaylor[/eluser]
I call a function inside the parent controller so it executes no matter what function is called for that controller. However, when I enable caching for a function (i.e. index) the function inside the parent controller is bypassed when that page is viewed. I assume I can still call a function using hooks but I was wondering at what stage to make such a call (i.e. pre_controller & post_controller).


Hooks and Cache - El Forum - 01-16-2010

[eluser]WebsiteDuck[/eluser]
I think using a pre_controller hook would work, but it sounds like it might be something you could use the controller's constructor for?
http://ellislab.com/codeigniter/user-guide/general/controllers.html#constructors

Edit:
Nevermind I see what you mean, I would try pre_controller or maybe doing something with cache_override


Hooks and Cache - El Forum - 01-16-2010

[eluser]seantaylor[/eluser]
Thanks for the advice. I will try this solution and post results.


Hooks and Cache - El Forum - 01-16-2010

[eluser]tomcode[/eluser]
I guess You need to use a pre_system hook, it's the only hook called before the cache file check.

1.7.2: file system/codeigniter/CodeIgniter.php line 89 - 114