A
A
andre77772015-04-15 17:10:17
CodeIgniter
andre7777, 2015-04-15 17:10:17

How to get site language code on CodeIgniter?

I am new to CodeIgniter.
Here is a demo that I 'm picking www.datingsoftware.ru/dating/demo.php
The site is multilingual (languages ​​are added from the admin panel).
How can I get the value of the language selected by the user anywhere in the code?
Next, in PHP I will write the conditions for displaying something, depending on the selected language.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Noffily, 2015-04-15
@Noffily

Try saving cookies with the user's language selected, and then process them.

V
Vitaly Kamelin, 2015-04-20
@turboGadjet

Sessions, cookies
For example, sessions:

// загружаем библиотеку там, где надо или добавляем ее в autoload.php
$this->load->library('session');

// устанавливаем значение
$this->session->set_userdata('language', 'ru');

// получаем значение
$this->session->userdata('language');

Read here www.codeigniter.com/user_guide/libraries/sessions.html and here www.codeigniter.com/user_guide/helpers/cookie_help...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question