Hi guys,

Thanks for the help.  Bernhard, I took your advice and changed the rss
controller to a feeds controller which works now.  I pointed /rss to /
feeds in routes so now either one works.

Here's my new problem: We want to have multiple feeds.  Press
releases, video, etc.  So I was planning on making the index function
a landing page and from there have different functions that go to the
different feeds.  Going to /feeds/videos is no problem.  However,
going to /rss/videos won't work the way I've got routes set up.  Now,
I've got:

$Route->connect('/rss', array('controller' => 'feeds', 'action' =>
'index'));

I want to add something that looks like this (using Perl regex):

$Route->connect('/rss/(*)', array('controller' => 'feeds', 'action' =>
$1));

That obviously doesn't work because it's the wrong syntax.  Is there a
way to do that easily?  Or am I going to have to reroute /rss/videos
to feeds.videos, rss/press_releases to feeds.pressReleases(), and so
on?  I'd prefer to do the redirect dynamically instead of hardcoding
it.

Adam, your idea is the way we originally had it set up.  We ran into
two problems though.  The first is we use a helper that sends out a
header which was interfering with declaring the feed as XML.  Second,
as we add video and other things we're using more than just the
Article model so we wanted to separate the RSS controller.  If it
weren't for that, we would just keep the RSS feed an action in the
Article controller like you were thinking.

Thanks for all your help!  It makes life as a new CakePHP developer a
lot easier.

-Max


On Oct 16, 9:03 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> What I would do is add a feed() action into your Articles controller.
> Then in your routes.php add:
>
> Router::parseExtensions('rss').
>
> Then you just call it like...
>
> /articles/feed.rss
>
> And it all works, assuming you've got the rss layout and stuff like
> that.
>
> Then you can change the url using routes as well if you want to.
>
> Cheers,
> Adam
>
> On Oct 17, 6:59 am, MaxCzap <[EMAIL PROTECTED]> wrote:
>
> > I'm having some trouble with Cake parsing the URL for my RSS feed.
> > I've got a controller that looks like this:
>
> > <?php
> > class RssController extends AppController {
>
> >         var $name = 'Rss';
> >         var $helpers = array('Time');
>
> >         var $uses = array('Article');
>
> >         /* RSS Feed: All articles */
> >         function index()
> >         {
> >                 /* Index method */
> >         }
> >         /* Other methods */}
>
> > ?>
>
> > Here's the weird bit.  If I go to mywebsite.com/rss I get the
> > following error: .
>
> > You are seeing this error because controller Controller could not be
> > found.
>
> > Notice: If you want to customize this error message, create app/views/
> > errors/missing_controller.thtml.
>
> > Fatal: Create the class below in file : app/controllers/controller.php
>
> > <?php
> > class Controller extends AppController {
> >    var $name = '';}
>
> > ?>
>
> > But it works if I go to "mywebsite.com/rss_"!  It's baffling.  I've
> > checked my routes.php file and commented everything out.  I'm a
> > relative newb to Cake, so I'm hoping someone can tell me where I
> > should be looking.  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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to