I may be completely off track here, but does the requirements field not
use regular expressions? If it does, is there not something you can do
like this:
requirements: { type: (image|video)s }
Tom Boutell wrote:
> I spent some time puzzling over these two routing rules today:
>
>
> images:
> url: /test/images
> param: { module: test, action: index, type: image }
>
> default_index:
> url: /:module
> param: { action: index }
>
> I had thought that calling link_to on this URL:
>
> test/index
>
> Would generate this:
>
> /test
>
> But it didn't. It generated /test/images.
>
> Eventually I read the fine manual and learned that parameters
> explicitly set in the way I have set type: here:
>
> images:
> url: /test/images
> param: { module: test, action: index, type: image }
>
> Are defaults, NOT things to be looked for and matched in the internal URI.
> Okay.
>
> So I rewrote my rule this way:
>
> test_types:
> url: /test/:type
> param: { module: test, action: index }
> requirements: { type: (image|video) }
>
> And indeed that works. It matches only when the second URL component
> is image or video, and lets other rules succeed otherwise. That's
> progress.
>
> However, I want the plural form in the URL rather than the singular.
> That is, I want:
>
> test/index?type=video
>
> To map to:
>
> /test/videos
>
> This would work if params set in the param: array were matched against
> the internal URI. Alas, by design, they are not.
>
> Is there a way to get the behavior I want with a pattern routing rule?
>
> Thanks!
>
--
Tom Haskins-Vaughan
Temple Street Media: Design and Development for the Web
[email protected] | www.templestreetmedia.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---