Is the purpose of the named parameter (lang) for you to be able to
present content in the specified language?
   John


On May 8, 2:28 pm, Pixelastic <timcc.pe...@gmail.com> wrote:
> Hello,
>
> I'm doing some i18n in my app and so I have defined routes with
> a :lang parameters like this :
> Router::connect('/:lang/:controller/:action/*', array('lang' => null),
> array('lang'=>'[a-z]{2}'));
>
> Everything is working fine.
>
> But I also have a index action that allow named parameters to be
> passed in the url to be used as filter.
> For example : /pages/index/parent_id:42 will display every pages that
> have a parent_id of 42. I can even add more named parameters (name:foo/
> flag:2/, etc) to filter the results more.
>
> Everyhing is working fine here too.
>
> My problem occurs when mixing the two. The urls generated for a
> filtered index should be /en/pages/index/parent_id:42, but instead
> they are /pages/index/parent_id:42/lang:en
>
> I've seen other posts about this issue on various blogs and on this
> google group (http://groups.google.fr/group/cake-php/browse_thread/
> thread/48138dfe5a4909ed/867d77a0cced6f70?lnk=gst&q=named
> +parameters#867d77a0cced6f70) and the suggested correction is to use
> Router::connectNamed(); with an array of every named parameters I want
> to allow (in my case : array('parent_id', 'name','flag'))
>
> But I can't do that, because the list of params is way too important
> and will change for every model, I want something more flexible.
>
> I thought about changing the way my filtered index is working by
> putting every filters in a single named paremeter ('filter') and
> allowing it. But I'm stuck at how to set in a single parameter a full
> list of key => values.
> Something like : /en/pages/index/filter:parent_id=42,name=foo,flag=2/
> could work but what if one of my filter values contain the characters
> "=" or "," ? Parsing the data would be difficult.
>
> I guess I'm going with this approach, but I'll be glad to hear an
> other solution if someone have one.
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to