Robert Basic’s Blog: Chaining routes in Zend Framework

There are commonly know features of Zend Framework, and some tiny ones that pass unnoticed until one wants something specific. One of such features are routes chains. Robert Basic wrote quick and simple tutorial about chaining routes through another one, to create multilanguage website URLs:

On a forum, there was a question today, about adding language “support” to the routes using Zend Framework. The guy wanted routes like /en/foo/bar or /de/baz. I wrote there an example for that using Zend_Router_Routes_Chain, so just posting that example here, too :) (..) Basically, we’re prepending the language route to the other routes. This way, we have defined the route for the languages in one place only, plus, the other routes don’t have to worry about the language, too.

Interested how Robert did it? Follow to his blog, see his 30-line code and think about all other possibilities.