Where to declare global variables? |
[eluser]pickupman[/eluser]
If there are variables that you would like to set for 1 controller you can use Code: //Controller I use both. config files for what would be static variables to replace define(). Doing something dynamic like a breadcrumb, page title, or user id, I might use the method shown above by putting the code into the constructor of the class. Once you get your feet wet with CI you find you can take this to the next level, by extending the Controller class. You can create custom controller classes for public and private controllers (think frontend/backend). Here's a great explanation. |
Messages In This Thread |
Where to declare global variables? - by El Forum - 05-14-2010, 01:52 PM
Where to declare global variables? - by El Forum - 05-14-2010, 02:23 PM
Where to declare global variables? - by El Forum - 05-14-2010, 02:25 PM
Where to declare global variables? - by El Forum - 05-14-2010, 02:27 PM
Where to declare global variables? - by El Forum - 05-14-2010, 02:34 PM
Where to declare global variables? - by El Forum - 05-14-2010, 02:45 PM
Where to declare global variables? - by El Forum - 05-14-2010, 03:23 PM
Where to declare global variables? - by El Forum - 05-14-2010, 07:52 PM
Where to declare global variables? - by El Forum - 11-16-2010, 10:16 AM
Where to declare global variables? - by El Forum - 11-17-2010, 04:38 AM
Where to declare global variables? - by El Forum - 11-17-2010, 03:23 PM
Where to declare global variables? - by El Forum - 01-16-2011, 11:39 AM
Where to declare global variables? - by El Forum - 01-18-2011, 09:18 PM
|