![]() |
how to use prdefined array globally ? - 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: how to use prdefined array globally ? (/showthread.php?tid=16505) |
how to use prdefined array globally ? - El Forum - 03-09-2009 [eluser]runrun[/eluser] Hi, I have an personal predefined array, where should I put it in CI, and how to call it ? how to use prdefined array globally ? - El Forum - 03-09-2009 [eluser]jedd[/eluser] [quote author="runrun" date="1236607041"] I have an personal predefined array, where should I put it in CI, and how to call it ?[/quote] How much data is in it, and how often does your code reference it? how to use prdefined array globally ? - El Forum - 03-09-2009 [eluser]runrun[/eluser] Like this Code: //translated date (english->vietnamese) how to use prdefined array globally ? - El Forum - 03-09-2009 [eluser]jedd[/eluser] Okay, if that's the extent of your data then you have a few options. You could conceivably piggyback the config.php file - but I think that'd be ugly. You could push that amount of data into your session - you've got 4K or so to work with there, remember. But I really think you'd be better off handling this as a language problem, and use the relevant features of CI. Have you read: [url="http://ellislab.com/codeigniter/user-guide/libraries/language.html"]http://ellislab.com/codeigniter/user-guide/libraries/language.html[/url] and [url="http://ellislab.com/codeigniter/user-guide/helpers/language_helper.html"]http://ellislab.com/codeigniter/user-guide/helpers/language_helper.html[/url] how to use prdefined array globally ? - El Forum - 03-09-2009 [eluser]TheFuzzy0ne[/eluser] You could also put it in your config.php file. It's very purpose is to load variables and make them available throughout your application. EDIT: Sorry, I missed the line where Jedd mentioned using the config.php. how to use prdefined array globally ? - El Forum - 03-09-2009 [eluser]xwero[/eluser] I agree with jedd this should go in language files. For English there is already the calendar_lang file you can use. how to use prdefined array globally ? - El Forum - 03-09-2009 [eluser]runrun[/eluser] Thank you |