Welcome Guest, Not a member yet? Register   Sign In
Can we activate one function for all crontroller without __construct?
#1

[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 Smile
#2

[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.
#3

[eluser]ghprod[/eluser]
Thanks Wan and Mangesh,

i'll try to take a look for your sugestions Smile

i'll give update after this finish Smile

Update: both solution so good Big Grin
but i'll try to go with base controller first Big Grin

regards




Theme © iAndrew 2016 - Forum software by © MyBB