how to use prdefined array globally ? |
[eluser]runrun[/eluser]
Hi, I have an personal predefined array, where should I put it in CI, and how to call it ?
[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?
[eluser]runrun[/eluser]
Like this Code: //translated date (english->vietnamese)
[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]
[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.
[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.
|
Welcome Guest, Not a member yet? Register Sign In |