Derek,
Ok, I think I’m getting close. I am now using the $SESS class as you recommended.
I have an index template in a template group called “press_kit.” Within this index template, I am using the embed tag to include the code that establishes the $SESS variables, which resides in a template called “webalias” in a template group called “includes.” Then, in “press_kit/index” I am just testing the variables using var_dump.
When it is setup this way, I get undefined for all the variables. However, if I move the code in “includes/webalias” directly into “press_kit/index,” everything works as expected.
Here is the code in “includes/webalias”
<?php
global $SESS;
global $IN;
//vars
$SESS->cache['radar']['web_alias']="";
$SESS->cache['radar']['fs_refer']="";
$SESS->cache['radar']['host_refer']="";
//Find out where the user came from
$SESS->cache['radar']['fs_refer'] = $IN->GBL('HTTP_REFERER', 'SERVER');
if (($SESS->cache['radar']['fs_refer'] == false) OR ($SESS->cache['radar']['fs_refer'] == "")){
$SESS->cache['radar']['web_alias'] = "grace";
} else {
$SESS->cache['radar']['host_refer'] = parse_url($SESS->cache['radar']['fs_refer']);
$SESS->cache['radar']['host_refer'] = $SESS->cache['radar']['host_refer']['host'];
$SESS->cache['radar']['fs_refer'] = explode("=", $SESS->cache['cleure']['fs_refer']);
//Set the WebAlis for outbound links back to mydomain.com
if (($host_refer == "www.mydomain.com") OR ($fs_refer == "mydomain.com")) {
$SESS->cache['radar']['web_alias'] = $SESS->cache['radar']['fs_refer'][1];
} else {
$SESS->cache['radar']['web_alias'] = "grace";
}
}
?>
Testing the variables:
<?php
global $SESS;
echo 'fs_refer:
';
var_dump($SESS->cache['radar']['fs_refer']);
echo "
";
echo 'host_refer:
';
var_dump($SESS->cache['radar']['host_refer']);
echo '
web_alias:
';
var_dump($SESS->cache['radar']['web_alias']);
?>
I’m clearly doing something wrong, but am not sure at this point what is.