I’ve got a contact page that upon success, redirects to /contact/success.
In that page’s controller can I limit direct access to that page unless coming from a redirect through /contact?
I’ve got a contact page that upon success, redirects to /contact/success.
In that page’s controller can I limit direct access to that page unless coming from a redirect through /contact?
If you store a value in the session (or in a cookie) before redirecting, you can check in your success controller/template if the given value is set and only show the page if that is the case. Or you could redirect with a parameter and use that to to evaluate whether or not the page is shown.
I was going to go the route of check the session variable in the “thanks” page controller.
However, here’s a stupid question. My “thanks” page is stored in /content/contact/thanks/simple.txt
Obviously loading the simple.php template. I could make a controller for that template, but if multiple pages use that template, I don’t want to store all those pages’ code in one controller.
Do I have any other options besides using a unique template name for that one page? Seems like a messy solution to me, but I understand why that might be the only option.
The alternative would be to use a double condition: if page id is x and session variable does not exist then redirect else show page.