Hello,
I’m not particularly sure whether this is a modx problem or a PHP fundamental problem, but the issue is, I have a snippet which sets a session variable on page A so that page B can receive the variable and display it. page A clears the session each time it loads the page, so that if a new choice on page A is chosen, then page B isn’t stuck with the wrong variable. I hope that makes sense.
Now, this works beautiful as it should, but if the user presses on their back browser button to go back to page A, the session isn’t cleared via the snippet, so page B still has the old page A variable values. If I goto page A via a link instead of simply going back from page B, it works fine. Both resources/pages are set to not cache in the modx settings, so I’m not sure what’s up.
Does anyone have any ideas? Should I include the PHP session code I’m using?
Thanks!
I think the problem is that the client’s browser is returning to a cached version of the page so the snippet isn’t executing (because it doesn’t exist in the final HTML of the page).
You might try putting this at the top of the page in the <head> section(not sure if it will work reliably):
<meta http-equiv="expires" value="Thu, 16 Mar 2000
11:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
I’m assuming that there’s a snippet on page 8 that decides what to display and that page 8 is designated as uncached in MODx. Try making the snippet cached: [[snippet]].
If that doesn’t work, try caching page 8 but making the snippet cached: [!snippet!].
If neither of those works, post the snippet here.