[FLOW3-general] Loop in Routing Parts
Bastian Waidelich
bastian at typo3.org
Mon Apr 9 23:55:36 CEST 2012
Johannes Steu wrote:
Hi Johannes,
> i'd like to have my route like this:
> http://... .de/cat1/cat2/cat3/ ... depending on the amount of subcategories.
> [...] Is it possible to build something like a loop in the routes.yaml
Loops in the route are not possible without custom RoutePartHandlers.
> If it is not possible i tired to set the part on my own. [...]
> Is it possible to keep the slash?
Yes, the "magic" lies in the method findValueToMatch() which you can
override. It receives the complete rest of the request path (e.g.
"cat1/cat2/cat3/foo.html") and you can return everything that belongs to
your route (in this case "cat1/cat2/cat3").
Then, in the matchValue() method you'll receive that part and can post
process it.
Just make sure that matchValue() and resoveValue() are deterministic and
that you are not allowed to return objects.
Also have a look at the NodeRoutePartHandler of the TYPO3 package [1] -
it's responsibility is to turn a request path into a TYPO3CR node vice
versa.
Please let us know if that helped,
Bastian
[1]
http://git.typo3.org/FLOW3/Packages/TYPO3.TYPO3.git?a=blob;f=Classes/Routing/FrontendNodeRoutePartHandler.php;h=bbe9081f33dbd84e67a2e920cb3cb474514ae13f;hb=HEAD
More information about the FLOW3-general
mailing list