Hi,
I've just started out with Phalcon, the first PHP framework I've ever used. I'm currently developing on a site which will be in both English and Swedish. The English site will feature four different pages being: Home, About, Contact and Extras. The Swedish site will be exactly the same but with: Hem, Om, Kontakt and Extra instead. I want the url to look like this:
https://baseurl/sv/hem https://baseurl/sv/om https://baseurl/sv/kontakt https://baseurl/sv/extra
https://baseurl/en/home https://baseurl/en/about https://baseurl/en/contact https://baseurl/en/extras
I want to use one controller per site and language meaning that both: https://baseurl/sv/home and https://baseurl/en/home goes to the same controller.
What would be the best way to achive this? I've looked into routing and tested this piece of code:
$router->add(
"/sv/om/:action",
array(
"language" => "sv",
"controller" => "about",
"action" => 2,
)
);
Even though this would work just fine, you would have to add every single controller, I would instead prefer to have some sort of configuration file like the following array:
$sites = array(
"hem" => "home",
"om" => "about",
"kontakt" => "contact",
"extra" => "extras"
);
To handle this instead. I've also looked into using convert for the route but I don't know how to implement that.
Much help is appreciated! Also great work with this awesome framework, I'm looking forward to dig deeper in to this.