>
>
> On May 28, 12:44 pm, Jon Bennett <jmbenn...@gmail.com> wrote:
>> hi,
>>
>> In 1.3, how hard is it to route a controller action to
>> /slug/child-slug/grandchild-slug and keep other, automatic routing in
>> place? Do you still need to explicitly route all other controllers and
>> their actions?
>>
>> I've done:
>>
>> Router::connect('/articles/:action',
>> array('controller'=>'articles'),
>> array('action' => 'admin_add|admin_edit|admin_index|admin_delete|admin_status')
>> );
>>
>
> The above route is equivalent to the default route - i.e. it's the
> same as not having it defined (incidentally what are your admin_*
> functions doing defined like that?¿? - you're disabling the automatic
> admin/prefix protection by doing that.)
I always use admin for prefixes, so it's not been an issue.
It's because I have routes like:
// Articles
Router::connect(
'/articles/:year/:month/:day',
array(
'controller' => 'articles',
'year' => null,
'month' => null,
'day' => null,
),
array(
'year' => '[12][0-9]{3}',
'month' => '0[1-9]|1[012]',
'day' => '0[1-9]|[12][0-9]|3[01]',
)
);
Router::connect('/articles/:category_handle',
array('controller' => 'articles', 'action' => 'index'),
array('category_handle' => '[A-Za-z0-9_\-]+')
);
Router::connect(
'/articles/:year/:month/:day/:handle',
array(
'controller' => 'articles',
'action'=>'view',
'year' => null,
'month' => null,
'day' => null,
'handle' => null,
),
array(
'year' => '[12][0-9]{3}',
'month' => '0[1-9]|1[012]',
'day' => '0[1-9]|[12][0-9]|3[01]',
'handle' =>'[A-Za-z0-9_\-]+',
)
);
Router::connect(
'/articles/:year/:month/:day/:handle/photos',
array(
'controller' => 'articles',
'action'=>'photos',
'year' => null,
'month' => null,
'day' => null,
'handle' => null
),
array(
'year' => '[12][0-9]{3}',
'month' => '0[1-9]|1[012]',
'day' => '0[1-9]|[12][0-9]|3[01]',
'handle' =>'[A-Za-z0-9_\-]+',
)
);
Router::connect(
'/articles/:year/:month/:day/:handle/photos/:photo_handle',
array(
'controller' => 'articles',
'action'=>'photo',
'year' => null,
'month' => null,
'day' => null,
'handle' => null,
'photo_handle' => null
),
array(
'year' => '[12][0-9]{3}',
'month' => '0[1-9]|1[012]',
'day' => '0[1-9]|[12][0-9]|3[01]',
'handle' =>'[A-Za-z0-9_\-]+',
'photo_handle' => '[A-Za-z0-9_\-]+',
)
);
>> previously, but would be even better if I could do the above but skip
>> all the method names.
>
> Well, previously - as now - you didn't need to, and you can if you
> want - as before - make routes more selective/less greedy with the 3rd
> parameter.
Got an example Andy?
I'm effectively trying to do:
Router::connect('/*', array('controller' => 'pages', 'action' => 'view'));
without removing all my other controller's routes.
Cheers,
J
--
jon bennett - www.jben.net - blog.jben.net
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment