How to call libraries in config file - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: How to call libraries in config file (/showthread.php?tid=67905) |
How to call libraries in config file - ardavan - 04-21-2017 Hi, I've made a general menu array in app_config.php to call it easily anywhere on my controllers. Now i decided to have multilingual functionality for my app and i cant use $this->lang->line('my_menu_name') in the config file. PHP Code: $config['menu'] = array( Is there any way to make this happen? (I can't change the menu array place - should be in app_config.php) Thanks guys RE: How to call libraries in config file - JayAdra - 04-21-2017 I would just use an English key in the config array, i.e. "profile" and then on the view side of things, call the lang line, e.g. PHP Code: foreach($config['menu'] as $key => $value) { RE: How to call libraries in config file - ardavan - 04-22-2017 (04-21-2017, 09:33 PM)JayAdra Wrote: I would just use an English key in the config array, i.e. "profile" and then on the view side of things, call the lang line, e.g. Thats a good idea and works for my menu names. but i have another arrays which the first item is like PHP Code: $config['country'] = array( And im using the array like this PHP Code: echo form_dropdown(array( How can be translate the 'Pick a Country' ? RE: How to call libraries in config file - JayAdra - 04-23-2017 Again, only use keys in the config arrays. In your view, simply call something like: PHP Code: $this->lang->line('placeholder_' . $key); |