Welcome Guest, Not a member yet? Register   Sign In
Multisite with codeigniter HMVC
#4

(This post was last modified: 12-05-2014, 11:06 PM by trentramseyer. Edit Reason: inserting code )

Really depends if they are running independently of each other as khalilhimura suggested you can just load different application folders per domain.

Or if you are doing a multi-site system that will grow dynamically, you can store the domain in the database table with the site information and look that up to get site information (make sure you index the domain field).  All your tables will need a site_id of some sort to look up information.

Something like below in model will let you look up.
PHP Code:
function site_lookup()
    {
        
$domain strtolower($_SERVER['HTTP_HOST']);
        
$domain explode('.'$domain);
        
$domain array_reverse($domain);
        
        
$this->db->select('*');
        
$this->db->from('sites');
        if(isset(
$domain[2]))
        {
            
$this->db->where('site.domain'$domain[2].".".$domain[1].".".$domain[0]);
        } else {
            
$this->db->where('site.domain'"www.".$domain[1].".".$domain[0]);
        }
        
$this->db->limit(1);
        return 
$this->db->get();
        
    } 
Reply


Messages In This Thread
Multisite with codeigniter HMVC - by sanjay - 11-07-2014, 05:21 AM
RE: Multisite with codeigniter HMVC - by gofrendi - 11-07-2014, 07:29 PM
RE: Multisite with codeigniter HMVC - by trentramseyer - 12-05-2014, 10:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB