Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Hacking RSS/Atom feeds
I’m looking to squeeze more out of the RSS and Atom functionality of Textpattern. Currently, I use the built-in RSS generator to provide feeds based on the article section, like this:
http://example.com/rss?section=foo
Now, in the past, I’ve had reason to extend the functionality of RSS and achieved this by building my own feed with a page + form combo, along with mg_setheader
to do the header stuff. This was fine for a single feed, but what I’d like to do is have a URL format akin to this:
http://example.com/rss?section=foo&expires=1&expired=0
…attributes a bit like article_custom
, in fact. What I’d ideally like to avoid is having to make a page + form combo for each of the sections I want to have this functionality; having one page + form to do this, with the URL specifying the article_custom
attributes is what I’m aiming for. Is such a thing possible?
Thank you in advance.
Offline
Re: Hacking RSS/Atom feeds
This could work:
<txp:etc_query globals="_GET">
<txp:article_custom
{$?({?section}|section="{?section}"|)}
{$?({?expired}|expired="{?expired}"|)}
... other attributes ...
/>
</txp:etc_query>
More details here.
Edit: small typo fix (expires=>expired), sorry.
Last edited by etc (2013-04-02 11:52:46)
Offline
Re: Hacking RSS/Atom feeds
Oleg, that’s great – thank you very much.
Offline
Re: Hacking RSS/Atom feeds
You are welcome, Pete! Actually, if you have adi_gps
installed, retrieving url data with adi_gps
and
<txp:article_custom
<txp:if_variable name="section">section='<txp:variable name="section" />'</txp:if_variable>
... other attributes ...
/>
should work too (untested). I have etc_query
installed on every site, so it’s kind of Pavlov reflex for me.
Last edited by etc (2013-04-02 11:15:04)
Offline
Re: Hacking RSS/Atom feeds
I’ll give both a try, Oleg – thank you again for your quick response.
Offline
Re: Hacking RSS/Atom feeds
The second solution is based on the controversial secondpass
feature though – might be not perennial.
Offline
Re: Hacking RSS/Atom feeds
Some suggested reading: Create and customize your own RSS feeds and Create a custom author feed and How-to : Generate a comments RSS feed
Offline
Re: Hacking RSS/Atom feeds
Thanks, Michael – I’ll take a look.
Offline
Pages: 1