The request handler can help out a great deal with that kind of thing.
if ( $this->RequestHandler->isRss() ) {
$this->Auth->allow('index');
}
You can use the same "if" to make the rss version of an action return
only the last 10 items or only items from the last week or whatever
else you may have set slightly differently in your rss controller.
My fuzzy point about parsing extensions is still valid I think. In the
router you are setting up an url that doesn't use an extension
(presses/rss). But in the view folder you are placing the view in the
rss folder (i.e. setting up for parse extensions). Nothing states that
any rss feed must use "views\presses\rss\" as the folder... that is
just a folder that parse extensions use to help you have two views for
the same action. the folder-name relates to the extension... not
really the type of view you are rendering so you don't have to use it
at all in this case. Or just use /presses.rss as the url and you are
done?
/Martin
On Feb 12, 6:36 pm, maestro777 <[email protected]> wrote:
> Martin,
> Thanks for the pointer. I did previously try the way you pointed out
> but it gave me the same error. Which kind of confused me even more. I
> understand your side note and the concept. The reason I am using
> rss_feed action instead of index.rss is because in my controller, the
> index is a authentication restricted whereas the RSS feed is a public
> access. Maybe I need to rethink my approach.
>
> Thanks Eddie for the link. I took a quick look and it looks similar to
> what I was doing. I'll check it in greater detail shortly.
>
> Appreciate both your inputs.
>
> On Feb 12, 5:06 am, Smelly_Eddie <[email protected]> wrote:
>
> > Maestro, I think this article may help you,
>
> > Add RSS Feeds to your CakePHP
> > Models;http://edwardawebb.com/programming/php-programming/cakephp/add-rss-fe...
>
> > On Feb 12, 6:32 am, Martin Westin <[email protected]> wrote:
>
> > > I am not really an expert on routing, but i'd say that you need to
> > > specify ext => rss like this
>
> > > Router::connect('/presses/rss', array('controller' => 'presses',
> > > 'action' => 'rss_feed',
> > > 'ext' => 'rss'
> > > ) );
>
> > > Side note:
> > > Since your action is called rss_feed I assume that you don't really
> > > have a "standard" view for it, right? You only really need to mess
> > > with parse extensions when you want the same action to render in more
> > > than one way. For example if /presses/index lists all presses and /
> > > presses/index.rss lists them in an rss feed. Same controller different
> > > views.
>
> > > On Feb 12, 3:12 am, maestro777 <[email protected]> wrote:
>
> > > > I'm trying to create an alternative routing for my RSS feed. In my
> > > > Route config, I have the following:
>
> > > > Router::connect('/presses/rss', array('controller' => 'presses',
> > > > 'action' => 'rss_feed',
> > > > 'url' => array('ext' => 'rss')
> > > > ) );
>
> > > > I have a rss_feed action created in the Presses controller.
>
> > > > I could get to the feed without problem using the url :
> > > > http://localhost/mysite/presses/rss_feed.rss
>
> > > > But when I tried using the alternative route I have an error:
>
> > > > Error: The view for PressesController::rss_feed() was not found.
>
> > > > Apparently it was looking for the view at ..\mysite\app\views\presses
> > > > \rss_feed.ctp instead of mysite\app\views\presses\rss\rss_feed.ctp
>
> > > > I'd appreciate very much if someone should help shed some light on
> > > > what I am not doing right. I have spent hours trying to figure this
> > > > thing out without success.
>
> > > > Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---