I’m having some trouble here, which will have a lot to do with the fact I have NO idea what I’m doing and 6 hours of trail an error is getting frustrating
Page 1 has a snippet to called [[GetPageTitle]] which does exactly that, and then stores it in a session variable called GetPageTitle
$_SESSION[$GetPageTitle]= $modx->documentObject['pagetitle'];
The when I go to Page 2 I have a snippet called [[referer]] which should tell me the URL from Page 1 and its title.
$referer = $_SERVER['HTTP_REFERER'];
$RefererPageTitle = isset($_SESSION[$GetPageTitle])? $_SESSION[$GetPageTitle]: 'Not Set';
$modx->setPlaceholder($RefererTitle, $RefererPageTitle);
$output .= $referer;
return $output;
It grabs the session variable GetPageTitle and gives it to a new variable called RefererPageTitle, otherwise displays "Not Set".
So far it all works.
This new variable should set a placeholder call RefererTitle which I can place on a page with [+RefererTitle+]
The Probelm is the placeholder doesn’t get the new variable or display "Not Set", however if I display it straight to the page I can see the page title which was set from Page 1.
$output .= 'Title = '.$RefererPageTitle;
return $output;
Therefore I must be doing something wrong with setting the place holder?