I’ve run into a very odd problem to do with session control on a site I’m building.
Briefly, the snippet I’ve written opens a session, and then sets a variable called ’terr’ depending on which of 5 different page’s id is returned by $modx->documentIdentifier
This snippet appears on every page of the site but should only be set if one of the page ids matches the 5 selected ones.
The snippet works fine on the pages where an id matches, but on pages were they don’t, the snippet seems to makes a match with page 138 which is my site start page.
The snippet looks like this:
session_start();
$pageid = $modx->documentIdentifier;
switch($pageid) {
case '138' : $_SESSION['terr'] = 'eur'; break;
case '115' : $_SESSION['terr'] = 'lon'; break;
case '129' : $_SESSION['terr'] = 'par'; break;
case '179' : $_SESSION['terr'] = 'loc'; break;
case '180' : $_SESSION['terr'] = 'crew'; break;
default : $_SESSION['terr'] = $_SESSION['terr']; break;
}
This could be something really stupid (I’m sure it is) but two of us have been at this for a couple of days now and we’re close to tears...