[development] Accommodating a second base_url

Khalid Baheyeldin kb at 2bits.com
Fri Oct 30 01:39:14 UTC 2009


Leave the $base_url alone. Drupal will figure it out automatically.

You can have one install (single code base), and one database, and don't set
$base_url.

Then do something like this in template.php:

<?php

function phptemplate_preprocess_page(&$vars) {
  switch($_SERVER['HTTP_HOST']) {
    case 'site1.example.com':
      $vars['banner'] = 'something1';
      break;
    case 'site2.example.com':
      $vars['banner'] = 'something1';
      break;
    case 'site3.example.com':
      $vars['banner'] = 'something1';
      break;
    case 'site4.example.com':
      $vars['banner'] = 'something1';
      break;
    default:
      $vars['banner'] = 'somethingX';
      break;
  }
}

Then in page.tpl.php do:

<?php print $banner ?>

That is all ...
-- 
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
Simplicity is the ultimate sophistication. --   Leonardo da Vinci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20091029/da11a6f1/attachment-0001.html 


More information about the development mailing list