Welcome Guest, Not a member yet? Register   Sign In
Sessions not working as expected...
#5

[eluser]satsilem[/eluser]
here I set the session.

class Frontpage extends Controller {

function Frontpage(){
parent::Controller();
$this->load->library('session');
}

function index(){
$newdata = array( 'lang' => 'en' );

$this->session->set_userdata($newdata);

$lang = $this->session->userdata('lang');
if ($lang == "en" ){$this->lang->load('en','en');}
/* get the main content of the website */
$profile_query = $this->db->query('SELECT title, text FROM scontent WHERE scontent_id="1"');

$title = "title_".$lang;
$content = "text_".$lang;
$row = $profile_query->row();
/* publish main content */
$data['content'] = '<h1>'.$this->lang->line('wellcome').'</h1>'.$row->$content;

/* publish navigation */
$data['navigation'] = "navigation_".$lang;
$data['footer'] = "footer_".$lang;
$data['meta'] = "meta_".$lang;

$this->load->view('site/template_view', $data);
}
}


Messages In This Thread
Sessions not working as expected... - by El Forum - 07-12-2007, 12:52 AM
Sessions not working as expected... - by El Forum - 07-12-2007, 01:09 AM
Sessions not working as expected... - by El Forum - 07-12-2007, 03:13 AM
Sessions not working as expected... - by El Forum - 07-12-2007, 03:26 AM
Sessions not working as expected... - by El Forum - 07-12-2007, 03:43 AM
Sessions not working as expected... - by El Forum - 07-12-2007, 04:27 AM
Sessions not working as expected... - by El Forum - 07-13-2007, 12:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB