Hi folks,
I’ve got a MODX Revolution setup with multiple contexts.
First I’ve got a multi-language setting with one context for each language and my gateway plugin code:
//make sure our plugin does not run on the mgr context (the manager)
if($modx->context->get('key') != "mgr"){
switch ($_REQUEST['cultureKey']) {
case 'en':
/* switch the context */
$modx->switchContext('english');
break;
case 'de':
/* switch the context */
$modx->switchContext('web');
break;
default:
/* Set the default context here */
$modx->switchContext('web');
break;
}
/* unset GET var to avoid
* appending cultureKey=xy to URLs by other components */
unset($_GET['cultureKey']);
}
But now I have other contexts for separate websites (but in relation to the main site) in one language.
They’re called via subdomains and I’d have thought it should be working with this gateway but doesn’t:
<?php
switch($modx->getOption('http_host')){
case 'subdomain.domain.com:80':
case 'subdomain.domain.com':
$modx->switchContext('subdomain');
break;
case 'subdomain2.domain.com:80':
case 'subdomain2.domain.com':
$modx->switchContext('subdomain2');
break;
default:
break;
}
//make sure our plugin does not run on the mgr context (the manager)
if($modx->context->get('key') != "mgr"){
switch ($_REQUEST['cultureKey']) {
case 'en':
/* switch the context */
$modx->switchContext('english');
break;
case 'de':
/* switch the context */
$modx->switchContext('web');
break;
default:
/* Set the default context here */
$modx->switchContext('web');
break;
}
/* unset GET var to avoid
* appending cultureKey=xy to URLs by other components */
unset($_GET['cultureKey']);
}