• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Always loading helper classes

#1
[eluser]Auzette[/eluser]
I have a helper class (url_helper) that I can see is going to be used on every page of my site. Rather than always add it to every controller that I write, I'd like to have a way to have it always loaded for every page automatically.

I'm guessing there may be other helpers that are similarly global in scope. I thought of creating a base controller that derived from CI_Controller, and then have every other controller derive from the base controller (and have the base controller itself initialize helpers via a call from the derived controller classes). Unfortunately, that doesn't seem to work, as the controllers can't find my basecontroller to derive from at the time they're initializing.

I guess the bottom line is, is there a general way that I can always have url_helper loaded without explicitly loading it in every controller?

Thanks for any insight.

Tim

#2
[eluser]Aken[/eluser]
application/config/autoload.php

#3
[eluser]Auzette[/eluser]
Shoot. That's TOO easy. Smile Thanks for the help!



Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.