Make Croogo Multisite

post_id: 57 / post_date: 2011-06-18



Making croogo multisite db and theme per domain consists of the following:

Am making the assumptions that db username is same for all sites, only the db will change. Also that the theme cannot be set from the admin panel, the theme with the name of the site will be used.

Changes:

.\app\config\bootstrap.php

$hostName = $_SERVER['HTTP_HOST'];
  $siteNames = array('site1.cselian.com' => 's1', 'site2.cselian.com' => 's2');
  $siteName = $siteNames[$hostName];
  define('SITE_DB', 'cselian_' . $siteName);
  define('SITE_THEME', $siteName);

.\app\config\database.php

  var $default = array(
    ...
    'database' => SITE_DB,

.\app_controller.php

  //find the line commented below and replace with the SITE_THEME one.
  //$this->theme = Configure::read('Site.theme');
  $this->theme = SITE_THEME;