I have played around with a small dynamic live site script.
This scripts makes the
$mosConfig_live_site-variable dynamic, and it changes as the actual live site does. This meens if you move your site from
www.example.com to
www.anotherone.com, the live site is automatically changed in the configuration.php
Here it comes:
First add these lines from line two, under the <?php tag:
PHP Code:
if($_SERVER['SERVER_PORT'] == 80) {
$root = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
} else {
$root = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF'];
}
$root = str_replace("/index.php","",$root);
$url = "http://".$root;
This script is an modified version of the script that can be found in mambos own installation. I have only added the port-function, if the live site uses a port it will be added to the URL.
Then, find the live site variable:
PHP Code:
$mosConfig_live_site = 'http://www.example.com';
Replace it with this:
PHP Code:
$mosConfig_live_site = $url ;
I have tried to work out the same thing for the pathway, but i am no pro coder and couln'd do it properly. I tried to replace it with the "getcwd()"-function in PHP, but it somehow didnt work. Nice if someone could help me on this one!
Anyway, i think this should be some sort of standard in mambo, at least an option.