• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multisite with codeigniter HMVC

#1
Rainbow 
Can we able to create the multisite with codeigniter HMVC

Like i have main domain www.example.com , want to create subdomain like www.demo1.example.com, www.demo2.example.com, www.demo3.example.com, likewise.

We must want to use same codebase, database. Only the subdomain different.

Any reference for this is really helpful,

Thanks in advance.
Sanjay
Reply

#2
(11-07-2014, 05:21 AM)sanjay Wrote: Can we able to create the multisite with codeigniter HMVC

Like i have main domain www.example.com , want to create subdomain like www.demo1.example.com, www.demo2.example.com, www.demo3.example.com, likewise.

We must want to use same codebase, database. Only the subdomain different.

Any reference for this is really helpful,

Thanks in advance.
Sanjay

You must want to see this http://blogid.me
It was built by using No-CMS (http://getnocms.com) which is built on top of CodeIgniter & HMVC
Reply

#3
Try checking out this tutorial

http://code.tutsplus.com/tutorials/basec...-net-16330

Maybe you could get some ideas about CI with subdomains. I'm trying to do something similar & currently going through the tutorial myself.

or perhaps another way is to have a single "system" folder with multiple "application" folders, like so:

[web root folder]
system -- main CI system folder
app-main -- application folder for domain : example.com
app-sub1 -- application folder for sub1 subdomain : sub1.example.com
app-sub2 -- application folder for sub2 subdomain : sub2.example.com


If the subdomains are to be dynamic names (e.g. username), the tutorial above would do the job.

I'll report back here once I'm done with the tutorial & see the outcome.
Reply

#4
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.