[TYPO3-50-general] Breaking changes in Routing
Thomas Fritz
fritztho at gmail.com
Mon Feb 16 18:38:11 CET 2009
On Mon, Feb 16, 2009 at 5:25 PM, Bastian Waidelich <bastian at typo3.org>wrote:
> Hi everybody,
>
> 3. "support for optional route parts" (see
> http://forge.typo3.org/issues/show/1790)
>
> By putting parts of the URI pattern in round brackets you can mark them
> optional.
> E.g. if you have a list of items and a page browser, you might have
> following route setup:
>
> ProductList:
> uriPattern: 'products(/{page}).html'
> defaults:
> page: '1'
>
> now the request path "products.html" would match and the argument "page"
> would have the default value of "1".
> "products/2.html" would match as well and "page" would have the value of
> "2".
> When you generate a link using a ViewHelper or Fluid, the result would be:
>
> array() --> "products.html"
> array('page' => '1') --> "products.html"
> array('page' => '2') --> "products/2.html"
>
> So the optional is only present, if it differs from it's default.
> If you want to force the page number to appear in the URI... well, just
> leave away the brackets: "products/{page}.html".
>
Thats awesome!! Thanks for this!
Best regards
Tom
More information about the TYPO3-project-5_0-general
mailing list