Advice please on best way to set Global Information - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Advice please on best way to set Global Information (/showthread.php?tid=16394) |
Advice please on best way to set Global Information - El Forum - 03-05-2009 [eluser]opel[/eluser] I am in the middle of building a large site that has a front end, admin and client area and have been using the modular extension library with controllers in the following format : module --controllers ----client.php ----module.php ----admin.php Every works great however I want to set some global variables across all three areas e.g. company information, terms and conditions. I have set up a company module and a pages module but I'm not sure the most efficient way in CI of passing the data. Should I create a library or use a pre-controller hook ? Any advice or examples of similar experiences would be appreciated. Cheers Advice please on best way to set Global Information - El Forum - 03-08-2009 [eluser]heavener[/eluser] For passing global data across the whole site, you could use a custom global language file? Advice please on best way to set Global Information - El Forum - 03-09-2009 [eluser]jedd[/eluser] [quote author="Opel" date="1236293115"] Every works great however I want to set some global variables across all three areas e.g. company information, terms and conditions. I have set up a company module and a pages module but I'm not sure the most efficient way in CI of passing the data.[/quote] The data you are referring to appear to be links to relatively static pages - so it's just the link that needs to appear in places, right? I'm guessing you already have footer() style function for example - seems the obvious place to put T&C's and AboutUs style info links. Advice please on best way to set Global Information - El Forum - 03-09-2009 [eluser]opel[/eluser] thanks for you answers. My pages system is slightly more dynamic so that a user can set a page to relate to a module and method. At the moment I have function running at the top of my template that explodes the URL and then makes the necessary lookup. I wasn't sure if it was better to use hooks to run the function or if there is a parent class in CI that runs prior to other controllers? Advice please on best way to set Global Information - El Forum - 03-09-2009 [eluser]jedd[/eluser] [quote author="Opel" date="1236615539"] At the moment I have function running at the top of my template that explodes the URL and then makes the necessary lookup. I wasn't sure if it was better to use hooks to run the function or if there is a parent class in CI that runs prior to other controllers?[/quote] You mean like this: [url="http://ellislab.com/forums/viewthread/107767/"]http://ellislab.com/forums/viewthread/107767/[/url] But you probably don't want to call views from within the parent controller class. I'm generating menu data there, f.e, but still calling from within my default view-php files. |