I’ve been pulling my hair our for 3 days trying to figure out why my extra contexts were returning 404.
http://modxcms.com/forums/index.php/topic,60223.0.html" target="_blank" rel="nofollow">I finally figured it out, but it got me thinking.
I think it would be a good idea if contexts could have aliases, so that different contextKeys initialise the same context.
For example, instead of
$modx->initialize('web');
I have
if(strpos($_SERVER['SERVER_NAME'],'example1.com')> -1) {
$modx->initialize('web');
} else {
$key = str_replace('www.','',$_SERVER['SERVER_NAME']);
if(strpos($_SERVER['SERVER_NAME'],'example2.mysite.com') > -1) {
$key = "example2.com";
}
if(strpos($_SERVER['SERVER_NAME'],'example3.mysite.com') > -1 ){
$key = "example3.com";
}
$modx->initialize($key);
}
If I could just have
$modx->initialize($_SERVER['SERVER_NAME']);
then modx could/would look for context settings that match the supplied key and initialize that context. I suggest that it looks for a context setting of ’context_alias’ and delimits on comma, pipe, or similar
That way a developer could use subdomains, $_GET variables, etc etc to quickly move between contexts on just one modx installation