Question

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.
Was it helpful?

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.

OTHER TIPS

If you move file to application/languages folder, use $this->lang->load()

There is no codeigniter function loading file.

You can use include function like:

include FCPATH.'htdocs/languages/english/common_lang.php';

or

include 'htdocs/languages/english/common_lang.php';

FCPATH is root folder.

$this->lang->load('./languages/english/common_lang.php', 'english');

Try

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top