Welcome Guest, Not a member yet? Register   Sign In
how to fetch whole language file in an array ?
#1

[eluser]Mossab Alzeeny[/eluser]
Hello guys,

im wondering if there's a way that lets me fetch a whole language file in an array,

what i understand is, if i have a template that has about 30 phrases,

i have to put each line in the $date array, and then call it in template

example :
Code:
class Main extends Controller {

    function Main()
    {
        parent::Controller();

    }

    function index()
    {

        $this->lang->load('index', "english");

        $data['hello_world'] = $this->lang->line('hello_world');
        $data['hello_world'] = $this->lang->line('hello_world');
        $data['hello_world'] = $this->lang->line('hello_world');
        $data['hello_world'] = $this->lang->line('hello_world');
        $data['hello_world'] = $this->lang->line('hello_world');
        $data['hello_world'] = $this->lang->line('hello_world');
        $data['hello_world'] = $this->lang->line('hello_world');
        $data['hello_world'] = $this->lang->line('hello_world');
        $data['hello_world'] = $this->lang->line('hello_world');

        $this->load->view('header',$data);

    }


}


but can i put the $this->lang->load command in a variable and then it'll automatically put all phrases in an array ?


i hope my question is clear to u and sorry if u didn't understand what i said ( still learning english Big Grin )


Kind Regards.
#2

[eluser]xwero[/eluser]
just add TRUE as a third parameter then you get the array.
Code:
$data['phrases'] = $this->lang->load('index', 'english', TRUE);
#3

[eluser]Mossab Alzeeny[/eluser]
[quote author="xwero" date="1228483238"]just add TRUE as a third parameter then you get the array.
Code:
$data['phrases'] = $this->lang->load('index', 'english', TRUE);
[/quote]

omg i love u CI even more :wow:

Thank you very much xwero

but why dont we see this thing about the third parameter in the user guide :question:




Theme © iAndrew 2016 - Forum software by © MyBB