Re: Help with routing (/cat/:alias/feed - /:cat/feed)

2009-03-23 Thread brian

Hey, sorry -- I forgot to reply to your earlier question. I don't know
why the feed route wouldn't work except that you might want to place
it ahead of the more general one.

I don't have any experience with parseExtensions so I can't really
help with this.

FWIW, I will need to use it very soon so I'm eager to see the solution
to your problem, as well.

On Mon, Mar 23, 2009 at 1:21 AM, rod rodrigo.z...@gmail.com wrote:

 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 rodrigo.z...@gmail.com 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 bally.z...@gmail.com wrote:

  On Fri, Mar 20, 2009 at 11:58 PM, rod rodrigo.z...@gmail.com 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 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
-~--~~~~--~~--~--~---



Re: Help with routing (/cat/:alias/feed - /:cat/feed)

2009-03-22 Thread rod

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 rodrigo.z...@gmail.com 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 bally.z...@gmail.com wrote:

  On Fri, Mar 20, 2009 at 11:58 PM, rod rodrigo.z...@gmail.com 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 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
-~--~~~~--~~--~--~---



Re: Help with routing (/cat/:alias/feed - /:cat/feed)

2009-03-21 Thread brian

On Fri, Mar 20, 2009 at 11:58 PM, rod rodrigo.z...@gmail.com 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 previous Router::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 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
-~--~~~~--~~--~--~---



Re: Help with routing (/cat/:alias/feed - /:cat/feed)

2009-03-21 Thread rod

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 bally.z...@gmail.com wrote:
 On Fri, Mar 20, 2009 at 11:58 PM, rod rodrigo.z...@gmail.com 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 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
-~--~~~~--~~--~--~---