Welcome Guest, Not a member yet? Register   Sign In
Session variables in smarty with CI
#8

[eluser]Jagar[/eluser]
I don't know how you have setup your smarty with CI, but if you have this line somewhere

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

require(APPPATH.'libraries/smarty/Smarty.class.php');

class Smarty_Parser extends Smarty {
    
    function __construct($config = array()){
        parent::Smarty();
        
        if (count($config)>0) {
            $this->initialize($config);
        }
        
        //register Smarty resource_name 'ci'
        $this->register_resource('ci',array($this, 'ci_get_template', 'ci_get_timestamp','ci_get_secure','ci_get_trusted'));

And you have session as autoload, then you can use the following to access the session from smarty.

[code]
<h1>{$CI->session->userdata('session_name')}</h1>

That will print the CI session.


Messages In This Thread
Session variables in smarty with CI - by El Forum - 04-02-2009, 05:50 AM
Session variables in smarty with CI - by El Forum - 04-08-2009, 05:06 AM
Session variables in smarty with CI - by El Forum - 04-08-2009, 05:11 AM
Session variables in smarty with CI - by El Forum - 04-08-2009, 05:15 AM
Session variables in smarty with CI - by El Forum - 04-08-2009, 09:05 AM
Session variables in smarty with CI - by El Forum - 04-08-2009, 10:10 PM
Session variables in smarty with CI - by El Forum - 04-29-2009, 05:34 PM
Session variables in smarty with CI - by El Forum - 04-30-2009, 06:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB