access a config variable inside helper function - 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: access a config variable inside helper function (/showthread.php?tid=24435) |
access a config variable inside helper function - El Forum - 11-10-2009 [eluser]ranjitbd[/eluser] Code: // meal is an array declared in a config file access a config variable inside helper function - El Forum - 11-10-2009 [eluser]Phil Sturgeon[/eluser] Unless you are in a controller, model, library or view you cannot use $this to access the CodeIgniter super-global. Normally you would need to do this: Code: $CI =& get_instance(); but you are in luck, there is a function for getting config items early on in the CodeIgniter load: Code: $meal = config_item('meal'); It's mostly in the manual. If its not, it's in the code! Explore the core libraries a little, it will help you understand what is going on a lot better than just waiting to find problems then asking on the forums. :-) |