I don’t see any problem giving my real domains here, so, my primary domain is pancakeinc.com, and my new context is floridapancake.com. We’ll be adding a new domain for each state over time (i.e., kansaspancake.com, texaspancake.com, etc.).
1. My context settings (context name is "florida") look like this:
base_url: /
http_host: floridapancake.com
site_start: 2 (this is the only page in my "florida" context, and it's published)
site_url: http://www.floridapancake.com
2. I’ve got two entries in my error log that look like this:
[2011-07-13 22:43:27] (ERROR @ /connectors/context/index.php) modManagerLog: Attempt to set NOT NULL field item to NULL
[2011-07-13 22:54:18] (ERROR @ /connectors/element/plugin.php) modPluginEvent: Attempt to set NOT NULL field priority to NULL
3. I’ve tried both methods above. Using the RTFM method, my plugin looks like this:
<?php
/* don't execute if in the Manager */
if ($modx->context->get('key') == 'mgr') {
return;
}
switch ($modx->getOption('http_host')) {
case 'floridapancake.tld:80':
case 'floridapancake.tld':
// if the http_host is of a specific domain, switch the context
$modx->switchContext('florida');
break;
default:
// by default, don't do anything
break;
}
Using the Belafonte method, my modified index.php code looks like this:
/* Setup context mapping */
switch ($modx->getOption('http_host')) {
case 'floridapancake.com:80':
case 'floridapancake.com':
// if the http_host is of a specific domain, switch the context
$modx->switchContext('florida');
break;
default:
// fallback, go to main context
$modx->initialize('web');
break;
}
Does any of this help? Those errors seems important to this, but I’m not sure what they mean. Thanks for the suggestion on the virtual hosts method. I could try that, but I’m actually wanting multiple top-level domains here...would that work for this?