Quote Originally Posted by sputnikinternet View Post
I worked it out with a bit of a hack.

Here is my new code for sites_switch.php
For pages that dont have the right cPath but need the other template, i manually added ?my_page=sports to the URL in the navigation.

<?php
$default_server_name = $_SERVER['HTTP_HOST'];
// $config_file = $default_server_name.'_config.php';

$my_length = strlen($cPath);
$my_remove = ($my_length - 2);
$my_remove = 0 - $my_remove;

if ($my_remove !=0){
$my_first_chars = substr($cPath, 0, $my_remove);
}
else {$my_first_chars = $cPath;}

if ($cPath == 4 || $my_page == "sports"){
$config_file = 'www.exedysports.sputcom2.co.uk_config.php';
}
else {$config_file = 'www.exedy.sputcom2.co.uk_config.php';}


if(file_exists("includes/config_sites/$config_file")) {
include("includes/config_sites/$config_file");
} else {
echo "the domain $config_file does not exist.";
exit;
}

//Name of the site that is written in the categories
define('SITE_NAME',$config_file);
//The order for this site will be seen for ORDER_SITE from the admin section
define('ORDER_SITE',SITE_NAME);
define('HTTP_SERVER', "http://$default_server_name");
define('HTTPS_SERVER', "https://$default_server_name");
?>
you should do something like that instead:
file includes/config_sites/www.exedy.sputcom2.co.uk_config.php
PHP Code:
$location explode('/',$_SERVER['REQUEST_URI']);
if(
$location[1]=='sports') { //config for the site in the folder /sports/
 
include('includes/config_sites/www.exedy.sputcom2.co.uk_sports_config.php');
} else {
  
//write here the config for the site in the root folder...

By doing that, you don't have to change the code of the site_switch.php
(and you don't need my_page=sports...)

Hope this helps !!

Gerome.