0

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.