Router::parseExtensions('rss'); Appears to be rewriting the 'url' =>
array('ext' => 'rss') in my connect:
Array
(
[ext] => html
[url] => cat/food/feed
)
Router::connect(
'/cat/:category/feed',
array('controller' => 'categories', 'action' => 'index', 'url'
=>
array('ext' => 'rss')),
array(
'category' => '[A-Za-z_-]+',
'pass' => array('category')
)
);
If I remove Router::parseExtensions('rss'); it works for
router::connect but won't work if I try to access it manually (http://
localhost/cat/food/index.rss)
Since I'll use the router one I guess I can remove the
parseExtensions, is that a bad idea?
On 21 mar, 19:00, rod <[email protected]> wrote:
> Thanks for your help,
>
> The first ::connect (/cat/:category/) works fine, but the second one
> for /feed still doesn't work.
>
> If I try to access /cat/category_name/index.rss I get an error, maybe
> that's the reason why /feed isn't working. However I can access it if
> I change the first ::connect to (/cat/:category/*) but still nothing
> for /feed
>
> Any idea?
>
> Thanks
>
> On 21 mar, 11:58, brian <[email protected]> wrote:
>
> > On Fri, Mar 20, 2009 at 11:58 PM, rod <[email protected]> wrote:
>
> > > Hi,
>
> > > I need help with routes.php, I've read the documentation and many
> > > blogs, articles but I still can't figure out how to do this:
>
> > >http://localhost/cat/categoryAlias/feed
>
> > > I have this which works fine:
>
> > >Router::connect(
> > > '/cat/:category',
> > > array('controller' => 'categories', 'action' => 'index'),
> > > array('category' => '(.*)')
> > > );
>
> > > But then I'd like to have, for example:http://localhost/cat/Food/feed
> > > - and that would point to Food/index.rss, however it doesn't work,
> > > probably due to (.*) in the previousRouter::connect.
>
> > You should tighten up the regexp a bit. Something like [-A-Za-z]+ or
> > [_A-Za-z]+ or thereabouts. It'll obviously depend on whatever rules
> > you have for creating your :category (slug)
>
> > Router::connect(
> > '/cat/:category',
> > array('controller' => 'categories', 'action' => 'index'),
> > array(
> > 'category' => '[-_A-Za-z]+',
> > 'pass' => array('category')
> > )
> > );
>
> > Router::connect(
> > '/cat/:category/feed',
> > array(
> > 'controller' => 'categories',
> > 'action' => 'index',
> > 'ext' => 'rss'
> > ),
> > array(
> > 'category' => '[-_A-Za-z]+',
> > 'pass' => array('category')
> > )
> > );
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---