Welcome Guest, Not a member yet? Register   Sign In
a process that occurs on EVERY page
#1

[eluser]deco10[/eluser]
I need to do some processing for my menu on every page of my site.
It seems silly to call a function in every function in the controller. The process will likely involve a data base call.

How should I approach this?
#2

[eluser]kgill[/eluser]
read up on creating core classes in the user guide, that's probably the easiest method though not the only one.
#3

[eluser]Jelmer[/eluser]
Autoloaded model or library that calls the necessary function for retrieval in its constructor and saves its output as a property?
#4

[eluser]jedd[/eluser]
[quote author="deco10" date="1250551135"]
I need to do some processing for my menu on every page of my site.
It seems silly to call a function in every function in the controller. The process will likely involve a data base call.
[/quote]

There's lots of threads that cover this in the forums already - check out these two: [url="http://ellislab.com/forums/viewthread/109698/"]Code duplication advice[/url] and [url="http://ellislab.com/forums/viewthread/110969/"]Finding it hard to start[/url]

Also read up on [url="http://ellislab.com/codeigniter/user-guide/general/core_classes.html"]Extending the Core Controller in the CI User Guide[/url].




Theme © iAndrew 2016 - Forum software by © MyBB