Yes, that's what I've searched for. I didn't know that I can use ".*"
in requirements (as I seed, I'm a regex noob). The link helper is also
fine, thank you Francois!
PS: that's the link helper I've build:
<code>function link_to_page($text, Page $page, $options = array())
{
$link = link_to($text, '@page?path=BREADCRUMB');
$breadcrumb = '';
foreach ($page->getPath() as $node)
{
$breadcrumb .= $node->getSanitized() . '/';
}
$breadcrumb .= $page->getSanitized();
return str_replace('BREADCRUMB', $breadcrumb, $link);
}</code>
On 6 Mai, 17:04, "Francois Zaninotto" <[EMAIL PROTECTED]
project.com> wrote:
> Pierre,
>
> For the routing rule, you'll just have to add a requirement for the path
> variable to make it greedy:
>
> my_rule:
> url: /route/:path
> params { whatever }
> requirements:
> path: '.*'
>
> But that won't be enough, because when you use link_to(), the slashes (/) in
> the parameters will be escaped and Apache will probably refuse them. So
> you'll have to trick the routing system into not escaping this variable, and
> this means a little hack.
>
> function link_to_path($text, $path)
> {
> $link = link_to($text, '@my_rule?path=PLACEHOLDER');
> return str_replace('PLACEHOLDER', $path, $link);
>
> }
>
> This should work somehow...
>
> François
>
> -----Message d'origine-----
> De : [email protected] [mailto:[EMAIL PROTECTED] De
> la part de Pierre Minnieur
> Envoyé : dimanche 6 mai 2007 14:15
> À : symfony developers
> Cc : [EMAIL PROTECTED]
> Objet : [symfony-devs] [Routing] Nested Set And Slash Separated Urls
>
> Hello,
>
> I'm not aware of regular expressions and so on, so I'm asking here
> directly:
>
> I have a Page model using Propel Nested Set behavior to provide some kind of
> hierarchical structure. Now I'd like to use the breadcrump/ path separated
> by a slash (/) in the url as route, e.g. /foo/bar.html will be the child
> "bar" of parent "foo".
>
> How do I have to set up the routing rule so that I have _one_ parameter
> which holds this breadcrumb/path?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---