Welcome Guest, Not a member yet? Register   Sign In
Access CI session from smarty templates
#3

[eluser]Jagar[/eluser]
I found the way and it may not be the best.

I'm using smarty templating engine, and inside my libraries/smarty_parser.php inside parse function I have the following:

Code:
function parse($template, $data='', $return = false){
        if ($template == ''){
            return false;
        }

        $CI =& get_instance();
        
        $this->assign('admin_logged',$CI->session->userdata('admin_logged'));

........ more stuff here -------


       }

now whenever i want to check if the admin is logged in i simply do
{if $admin_logged)
more option for admin here
{/if}
Please if there is a better way to do it, please let me know, but I'm posting here in case anyone else is wondering.


Messages In This Thread
Access CI session from smarty templates - by El Forum - 04-26-2009, 03:24 PM
Access CI session from smarty templates - by El Forum - 04-27-2009, 09:39 AM
Access CI session from smarty templates - by El Forum - 04-27-2009, 11:56 AM
Access CI session from smarty templates - by El Forum - 04-30-2009, 08:22 AM
Access CI session from smarty templates - by El Forum - 11-23-2013, 11:56 AM
Access CI session from smarty templates - by El Forum - 11-23-2013, 07:20 PM
Access CI session from smarty templates - by El Forum - 11-23-2013, 11:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB