Welcome Guest, Not a member yet? Register   Sign In
Developing a multiple site application
#3

[eluser]n0xie[/eluser]
Why use an Hook? Might as well use a base controller which sets in which 'league' you are.
Code:
//pseudo code
class MY_Controller extends Controller {

    protected $league;        // league properties (css / theme etc)
    protected $league_id;    // league id

    function __construct()
    {
        parent::Controller();
        $this->_set_league();
    }
    
    private function _set_league()
    {
        // example, might want to use a model or session
        $query = $this->db->where('url', $this->input->server('HTTP_HOST'))->limit(1)->get('ligas');
        
        if ($query->num_rows() > 0)
        {
            $this->league         = $query->row();
            $this->league_id     = $query->row()->id;
        }
        else
        {
            show_404('site does not exists');
        }
    }
}


Messages In This Thread
Developing a multiple site application - by El Forum - 12-06-2010, 11:38 AM
Developing a multiple site application - by El Forum - 12-06-2010, 12:28 PM
Developing a multiple site application - by El Forum - 12-07-2010, 07:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB