Can we activate one function for all crontroller without __construct? |
[eluser]ghprod[/eluser]
Hi, a quick question, i want to activate one function whenever CI loaded, for all controller, without place instance or running code in every __construct controller. can we? and how to do that? thanks and regards
[eluser]WanWizard[/eluser]
Use base controllers, and have your controllers extend the base controller. All code that is generic for all controllers (extending that particular base controller) should be placed in that base controller so you code it only once. See http://philsturgeon.co.uk/blog/2010/02/C...ing-it-DRY.
[eluser]ghprod[/eluser]
Thanks Wan and Mangesh, i'll try to take a look for your sugestions i'll give update after this finish Update: both solution so good but i'll try to go with base controller first regards |
Welcome Guest, Not a member yet? Register Sign In |