That doesn't seem to work, I get Missing Action errors.
Router doesn't seem to check wether an :action actually exists or not.

Chrs anyway,
Dav

On 21 Aug 2008, at 22:31, theChrisWalker wrote:

>
> I haven't tested it but from memory you could refactor those routes
> to:
>
> Router::connect('/events/:action/*', array('controller' => 'events',
> 'action' => 'index'));
> Router::connect('/events/*', array('controller' => 'events', 'action'
> => 'index'));
>
> as the first will match only actions and the second will pick up the
> left-overs.
>
> On Aug 20, 7:48 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> Sorry for the late comeback...
>>
>> I didn't want to break all the old links, so I left the parsing
>> algorithm as it is. I was able to reduce the lines of code thanks to
>> some more efficient features in 1.2 anyway, so that's alright. :o)
>>
>> There's one thing I wonder about though. The URLs used in the app can
>> be either:
>> /:controller/:action/:id
>> for things like /events/edit/<id>,
>>
>> or they're:
>> /:controller/:random/:params
>> for things like /events/in/<area>/concerts.
>>
>> The latter ones are all routed through to $EventsController->index(),
>> where the URL parsing magique happens.
>> Right now I'm doing this by specifying these routes:
>>
>> Router::connect('/events/add', array('controller' => 'events',
>> 'action' => 'add'));
>> Router::connect('/events/edit/*', array('controller' => 'events',
>> 'action' => 'edit'));
>> Router::connect('/events/show/*', array('controller' => 'events',
>> 'action' => 'show'));
>> Router::connect('/events/*', array('controller' => 'events', 'action'
>> => 'index'));
>>
>> Is there a way to consolidate these rules somehow? Basically,
>> everything that is not an actual action in my EventsController should
>> be send to the index() method. Will I have to override the error
>> handling class to do that?
>>
>> Chrs,
>> Dav
>>
>> On 11 Aug 2008, at 22:09, [EMAIL PROTECTED] wrote:
>>
>>
>>
>>> Hi David,
>>> I am no authority but from what I know of the router in Cake I'd say
>>> probably not.
>>
>>> You may be able to get part of the way there with named routes: /
>>> events/in:newyork/near:MickyDs
>>> Problem is you seem to be limited to one of each. You can not have
>>> Router parse two named parameters with the same name and get an  
>>> array.
>>> Instead a later parameter overwrites the previous. near:thefirst/
>>> near:thesecond generates only a param for near => "thesecond"
>>> It would be cool if it worked the other way and maybe you can tweak
>>> the code to do it for you. But you would still not have exactly the
>>> urls you want.
>>
>>> What could possibly do it all for you is regexp routing. I just
>>> remember reading about it a while back but since I suck at regexp I
>>> took little notice. If that feature can overcome the limitation  
>>> above
>>> then you could probably write a routing rule-set for your app.
>>
>>> It is the last thing tested in router.test.php
>>
>>> /Martin
>>
>>> On Aug 11, 11:10 am, David Christopher Zentgraf <[EMAIL PROTECTED]>
>>> wrote:
>>>> Hi,
>>
>>>> I'm in the midst of updating a 1.1 app to Cake 1.2, and am looking
>>>> into how flexible routes are.
>>>> The app centers around really custom URLs, like:
>>
>>>> /events/in/<place>/2008/08/13   or   /events/concerts/near/ 
>>>> <station>/
>>>> 2009/04
>>
>>>> There can be four different parameters in the URL:
>>>> - areas, distinguished by keyword /in/
>>>> - stations or POIs, distinguished by keyword /near/
>>>> - categories, distinguished by not being a number
>>>> - dates, distinguished by being a number
>>
>>>> These can occur in any order and quantity. While I'm updating  
>>>> anyway,
>>>> I'd like to replace the parsing algorithm for the URL by routes  
>>>> if at
>>>> all possible; but routes don't seem to be flexible enough for the
>>>> task, as they require parameters in a fixed order?
>>
>>>> Any input appreciated,
>>>> Dav
> >


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to