Welcome Guest, Not a member yet? Register   Sign In
best way to do this?
#7

[eluser]Wondering Coder[/eluser]
hi,

thanks for helping me out of this one.

I like the idea of extending My_Controller, in fact I'm using one.:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_Controller {
    /**
     * Class Constructor
     *
     * @access    public
     * @return    void
     */
    public function __construct()
    {
        parent::__construct();
    }
    
       public function is_logged_in()
    {
        $is_logged_in = $this->session->userdata('is_logged_in');
        if(!isset($is_logged_in) || $is_logged_in != true)
        {
            echo 'You don\'t have permission to access this page. <a href="../">Login</a>';    
            die();        
        }        
    }
}

but how can I achieve loading all my common variable in My_Controller and accessing it to my other controllers? don't know how to do this. T_T


Messages In This Thread
best way to do this? - by El Forum - 04-10-2011, 03:18 AM
best way to do this? - by El Forum - 04-10-2011, 03:20 AM
best way to do this? - by El Forum - 04-10-2011, 07:34 AM
best way to do this? - by El Forum - 04-10-2011, 07:37 AM
best way to do this? - by El Forum - 04-10-2011, 09:51 AM
best way to do this? - by El Forum - 04-10-2011, 10:18 AM
best way to do this? - by El Forum - 04-11-2011, 09:34 PM
best way to do this? - by El Forum - 04-12-2011, 06:35 AM
best way to do this? - by El Forum - 04-12-2011, 10:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB