28. November 2006 18:56
General . PHP
Today, I was once again testing the Zed Framework. One of the things I was trying to do, is creating URL's in different languages. What I did was creating a controller 'user', with the action 'edit' (i.e. www.example.com/user/edit). Now, I want this to be available in Dutch too (i.e. www.example.com/gebruiker/bewerken).
The trick is to add custom routes, which map back to the real controller and action. In my case, adding the following in my index.php did the job:
array('controller' => 'user', 'action' => 'edit')) );
Only bad thing is that you should add this for all your actions, otherwise not all routes succeed.
Another important note is that routes are matched in reverse order. Make sure your most generic routes are defined first, and more specific routes last.