how can i print language key in controller in Codeigniter. I usually use
$this->lang->load('filename', 'language');
$this->lang->line('language_key');
To get the key and after pass it to the view, for example:
$data["language_msg"] = $this->lang->line("msg_hello_english");
$this->load->view('language_view', $data);
But what if i want to use the key in the controller ? I mean i have to get the key and after echo that in the controller which will print the text value in the page, when it is called ?
I really need help about this !
Thank you so much,
federico
Simply echo this:
echo $this->lang->line("msg_hello_english");
or use the variable anyway you want to.
However, generally you don't want to do this directly from your controller - that's what you have views for. If you are doing much of that, consider if you are making a bad design pattern.