Well, seems I'm here again...
In the rss-template I need to put link elements that refer to the html
versions. They need to be absolute links (as far as I can see, otherwise it
doesn't work). I output them through $rq->getUrlHost() . $ro->gen('Nieuws'); Is
there an option to generate an absolute url?
Apparently agavi automatically assumes I want the rss version (I'm guessing it
detects the current output type?) and appends /rss. Is it possible to specify
that this is not the rss-version but the default (html) version? Something
like: $ro->gen('Nieuws-rss')?
Koen
P.S.: When I get this all sorted out I'd be willing to write it all up for the
cookbook as an extended example or other. Or maybe add something similar to the
default app?
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Namens Van Daele, Koen
> Verzonden: woensdag 24 januari 2007 11:15
> Aan: Agavi Users Mailing List
> Onderwerp: Re: [Agavi-Users] Generating a RSS feed
>
> One more thing, generating the rss version of a route doesn't
> seem to work.
>
> Echo $ro->gen('Nieuws+rss'); only generates the first part
> (the /rss isn't appended). Something wrong with the syntax?
>
> Koen
>
> > -----Oorspronkelijk bericht-----
> > Van: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Namens Van Daele, Koen
> > Verzonden: woensdag 24 januari 2007 10:17
> > Aan: Agavi Users Mailing List
> > Onderwerp: Re: [Agavi-Users] Generating a RSS feed
> >
> > David,
> >
> > Thanks for the explanation. Works like a charm.
> > One more question: is it possible to have a parameter in a
> route that
> > only appears for a certain ouptut type.
> > E.g.: I have the route
> > <route name="Nieuws" pattern="^/nieuws/(page:\S+)?"
> > module="Algemeen" action="NieuwsTonen>
> > <defaults>
> > <default for="page">1</default>
> > </default>
> > </route>
> >
> > Combined with the rss output type this gives url's like
> /nieuws/1/rss.
> > This is not very elegant and the page parameter is actually only
> > relevant for the html output (sine that is paged, but rss just
> > displays the latest X news items).
> >
> > Greetings,
> > Koen
> >
> > P.S.: I already had a baseview, but I did not have the setup with
> > executeHtml(). Thanks for the tip.
> >
> >
> > > -----Oorspronkelijk bericht-----
> > > Van: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] Namens David Zülke
> > > Verzonden: maandag 22 januari 2007 13:58
> > > Aan: Agavi Users Mailing List
> > > Onderwerp: Re: [Agavi-Users] Generating a RSS feed
> > >
> > > Hi Koen,
> > >
> > > you were right - all you need is a new output type!
> > >
> > > First, you have to define that new one (e.g. "rss") in
> > > output_types.xml. You can define a renderer if you want to use a
> > > template to generate the output, or you omit the renderer
> > definition
> > > and use a library to generate the RSS content in the view
> > (even though
> > > I'm not aware of any PHP libraries that generate RSS).
> > > Next, simply define executeRss() in your View and put the
> necessary
> > > code in there.
> > > Now all that's left is to decide that we want RSS as the
> > output type
> > > and not HTML. To do that, you have several options. You
> can use the
> > > routing:
> > > <route name="rss" stop="false" pattern="/rss$"
> > > output_type="rss" /> That will set the output type to "rss"
> > > for all URLs that end on /rss.
> > > You can generate such an RSS variant of a URL using
> > $r->gen('routename
> > > +rss', ...);
> > > Alternatively, you could use a filter, but that's not very
> > elegant.
> > > The last opportunity to change the output type is in your view's
> > > initialize method, you could check a request parameter there or
> > > something. But using the routing is definitely the way to go.
> > >
> > > Hope that helps,
> > >
> > > David
> > >
> > >
> > > P.S: it is recommended that you have a MyBaseView from
> > which all views
> > > extend. This base view has an execute() method that throws an
> > > exception, or forwards to a 404 action. All your specific views
> > > implement only executeHtml(), executeRss() etc methods.
> > That way, you
> > > do not need to worry about the routing setting an output
> type that
> > > some of your actions/views do not implement.
> > >
> > >
> > >
> > > Am 22.01.2007 um 08:58 schrieb Van Daele, Koen:
> > >
> > > > Hi,
> > > >
> > > > I'd like to make a RSS feed for newsitems. I've already got
> > > an action
> > > > a a view to display the html page with the newsitems, but
> > > now I'd like
> > > > to generate a feed for this.
> > > >
> > > > Do I need to define a completely different but identical
> > action for
> > > > this or can I reuse the action and e.g. set the output
> > type to rss?
> > > > Can anyone give an example of the different files that
> need to be
> > > > altered for this (routing, output_types, view, ...)?
> > > >
> > > > Greetings,
> > > > Koen
> > > >
> > > > _______________________________________________
> > > > users mailing list
> > > > [email protected]
> > > > http://lists.agavi.org/mailman/listinfo/users
> > > >
> > >
> > >
> > > _______________________________________________
> > > users mailing list
> > > [email protected]
> > > http://lists.agavi.org/mailman/listinfo/users
> > >
> >
> > _______________________________________________
> > users mailing list
> > [email protected]
> > http://lists.agavi.org/mailman/listinfo/users
> >
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users