Search code examples
phpcodeignitercodeigniter-2codeigniter-routing

Call language file outside "application" folder in Codeigniter 2


How to call language file outside the application folder in codeigniter 2.

file structure is as shown below.

/
/application
/system
/htdocs/languages/english/common_lang.php   -- my language file.

Solution

  • Just an idea ...

    1) Create a new language common_lang.php file in application/language folder.

    2) Include your /htdocs/languages/english/common_lang.php in the new application/language/common_lang.php

    3) Then, simply load this new language file using $this->lang->load('common_lang.php', 'english');

    I am assuming your /htdocs/languages/english/common_lang.php is in the $lang['language_key'] = "message"; format. If not you may have to figure out a way to prepare a $lang array.