I’m still experimenting with URL routes and just managed to get it to work.
my routes.ini has this:
[production]
routes.register.route = :lang/register
routes.register.defaults.controller = register
routes.register.defaults.action = index
routes.register.defaults.lang = en
routes.register.reqs.lang = “[a-z]{2}”
My URL would look like this:
http://www.mysite.com/en/register
So now, in my controller I can do this:
$lang = $request->getParam('lang');
My problem is: I’m trying to get a list of countries in a select element, which depending if the lang element is english or french, will return the countries in said language.
To do so, I would need to pass “lang” to the form.
Then in the form, pass it to the model querying the countries there.
And if there’s a change, it makes for a lot of places to change as well.
So back to the question:
Can I just set this variable as global?
I would pass the variable to the form from your controller.