When you create a multi-site installation, an important table to duplicate is the variable table. However, by duplicating this table, you will also duplicate some variables that you might prefer not to. To force a set value for these variables, for all of your websites, you can do the following.

First, you will probably have a settings.php file for each site in your installation, like sites/example.com/settings.php. Edit each file and add the following to the end.

include_once ('./sites/default/shared_variables.php');

Now, in the default directory, add a file called sites/default/shared_variables.php containing the following.

/**
 * These variables are fixed for all sites that have this line of 
 * code in their settings.php file:
 * 
 *      include_once ('./sites/default/shared_variables.php');
 */
$conf = array(
  'site_name' => 'All these sites are belong to us.',
  'theme_default' => 'pushbutton',
  'anonymous' => 'Visitor'
);

The element names (eg. 'site_name') correspond to a variable in the variable table. So no matter how many copies of the variable table that you need, each site in your multi-site installation will defer to the variables that you define in the $conf array in your shared_variables.php file.

The disadvantage is that these variables cannot be edited via the Drupal admin pages.

Comments

Ramy’s picture

Do you realize that writing it that way will overwrite $conf variable and any thing you add to your settings.php will be overwritten if you included that file to the end of your settings.php?

You can do the same thing you want to do though. But more like:

<?php
$conf['common_variable_name'] = 'common_variable_value';

Also, removing PHP closing tags is a standard by now.