[eluser]GabrieleMartino[/eluser]
[quote author="TheFuzzy0ne" date="1363163937"]Can you be more specific?
If you need shared functionality, it's probably best to put it into a library or helper, or to create a base controller which has the functionality you require, and extend that from the other controllers that require it.[/quote]
Of course, thanks.
I have in my pages controller the following function
Code:
public function pick_up($user_id){
/* Questo metodo fa riferimento agli id ma per via della
* Select nella DROPDOWNLIST della home è stato chiamato
* id anche Select not necessary che è una stringa.
*
*/
$name_language = $this->input->post('languages');//The language of the site
$email = $this->session->userdata('email');
$this->users_model->set_current_chat_by_email($email,'1'); //This set the current chat to no one
$subjects = $this->input->post('subject'); //The subject of the room
if($subjects == ''){ //If no subject is specified
redirect('chat/enter_living_room/'.$this->input->post('languages')); //enter the lounge
}
$data['title'] = 'Safe Memoirs';
$data['subjects'] = $subjects;
$data['language'] = $this->languages_model->get_language_by_name($name_language);
//The numbers of room active with the same subject
$data['number_rooms'] = $this->chats_model->number_online($subjects,$data['language']);
//Load language files
if ($this->session->userdata('language')!== FALSE){
$this->lang->load('menu',$this->session->userdata('language'));
$this->lang->load('pick_up',$this->session->userdata('language'));
}else{
$this->lang->load('menu','english');
$this->lang->load('pick_up','english');
}
$this->load->view('templates/header', $data);
$this->load->view('templates/menu');
$this->load->view('pages/pick_up', $data);
$this->load->view('templates/footer', $data);
}
And in my chat controller
Code:
public function enter_living_room($language){
$this->lang->load('chat_view',$this->session->userdata('language'));
$subject = $this->lang->line('living_room');
$chat_id = $this->chats_model->exist_room($subject,$language);//If a living_room already exist
if($chat_id == false){
$this->create_new_living_room($subject,$language);
$chat_id = $this->session->userdata('chat_id');
}
$this->session->set_userdata('room','living_room');
$this->enter($chat_id,'false');
}