I have a specific parameter which, if set, I would like to append to all page calls within my site. The parameter is already stored to a variable by the controller, so all I need to do is check if a route leads to a page within the site and append the parameter to the route that is being called.
I’ve just been over the cookbook and am unsure on whether to go about this with routes or hooks. Is this a case for a “route:before” hook or do I set up a route with an “:all” pattern?
So, the way I understand it, I won’t be able to pass variables to the called page within the route:before and :after hooks, right? So this should be done with a route instead of a hook?
But if that’s the case, looking at the routing cookbook, I’m unsure of how to access a parameter that had been set on the origin page and pass it on to the target page.
It would probably make more sense to use a cookie and then check if the cookie is set where you need. Or check in the hook if the cookie is set and then redirect using the cookie value.
Thanks, you’re absolutely right, of course - a cookie is the way to go here.
I got so focused on using the hooks/routes tool set that this much more obvious approach escaped my mind. -.-