Difference between revisions of "Issue:RSS from DPL?"

From FollowTheScore
Jump to: navigation, search
(Reply: Cool but nonworking example)
 
Line 49: Line 49:
  
 
--[[User:Maiden taiwan|Maiden taiwan]] 19:00, 9 July 2008 (CEST)
 
--[[User:Maiden taiwan|Maiden taiwan]] 19:00, 9 July 2008 (CEST)
 +
 +
:Hi guys, here's a little background on WAF:
 +
:* It uses the standard cache to store feeds so as not to have to re-render them on each request.  Re-rendering each time could be very expensive of course since RSS sources tend to get pounded.
 +
:* To determine whether it needs to re-render the feed, it checks the same things that an article checks.  That is, first it looks to see if the article itself has a newer timestamp than the last feed generation time, then checks if any transcluded article or templates has a newer timestamp.  If anything has a newer timestamp than the last generation time of the feed, it regenerates.
 +
: That's the crux of the problem, it's the same as why an article with a <nowiki><DPL></nowiki> tag won't update unless you purge the page or perform an edit.  However, there may be a workaround.
 +
: MediaWiki stores template relationships in the <tt>templatelinks</tt> table, and the ParserOutput class's <tt>addTemplate()</tt> method can be used to create such a relationship, even if the article doesn't actually transclude the specified page.
 +
: So, if the <tt><nowiki>{{#dpl:}}</nowiki></tt> parser function would do a <tt><nowiki>$parser->mOutput->addTemplate()</nowiki></tt> call for the category being dynamically queried, it may be enough to signal to MediaWiki that changes to the category should force the article (and tangentially, WikiArticleFeeds) to re-render.  I think it's worth a shot. --[[User:Jimbojw|Jimbojw]] 19:08, 17 July 2008 (CEST)

Latest revision as of 18:08, 17 July 2008

Description: Make each DPL into an RSS feed?
Extension / Version: DPL   /   Any
Type / Status: Change Request   /   open

Change request

It would be great if you could use a DPL to output an RSS or an Atom feed. Not sure exactly how the syntax would work, because you would not want to embed the actual XML in the page, but rather see the XML version of the DPL after clicking a certain link...

I have a prototype running from the MetaBase homepage, which you can see directly here; http://biodatabase.org/index.php?title=Template:New_Database_List/Feed

That prototype works by using the 'WikiArticleFeeds' (version 0.6.3) extension, which can be found here; http://jimbojw.com/wiki/index.php?title=WikiArticleFeeds

While that is all well and good, it would be nice if it was better!

Thanks for your consideration,

--Dmb 14:06, 26 February 2008 (CET)


Reply

Hello Dan, what you did looks quite nice to me. DPL can indeed be used to create contents for a publishing system like WikiArticleFeeds. The outer tag structure cares for feed creation, DPL decides what is in the feed. I wonder what happens if you touch the wiki page and re-save it. If there is one new item found by the query: will the publishing system be smart enough to recognize exactly this one as "new" and leave the rest in peace? Did you try things like that?

What precisely do you think can be improved?

Gero 23:09, 26 February 2008 (CET)

If you touch and resave the article, the new entry does get picked up by RSS. However, if you don't touch the article, RSS never notices if the DPL output changes. For instance, the template below turns a category into an RSS feed, but it's useless because you have to touch & save the page to make it update.
<includeonly><startFeed title="Important changes"/></includeonly>
{{#dpl:
| category = {{{category}}}
| ordermethod = lastedit
| order = descending
| addlasteditor = true
| addeditdate = true
| minoredits = exclude
| format = \n,== %PAGE% ==\n\n,[[%PAGE%|%TITLE%]] modified %DATE% by [[User:%USER%|%USER%]]\n\n,
| noresultsheader = No results for category {{{category}}}.
}}
<includeonly><endFeed/></includeonly>

--Maiden taiwan 19:00, 9 July 2008 (CEST)

Hi guys, here's a little background on WAF:
  • It uses the standard cache to store feeds so as not to have to re-render them on each request. Re-rendering each time could be very expensive of course since RSS sources tend to get pounded.
  • To determine whether it needs to re-render the feed, it checks the same things that an article checks. That is, first it looks to see if the article itself has a newer timestamp than the last feed generation time, then checks if any transcluded article or templates has a newer timestamp. If anything has a newer timestamp than the last generation time of the feed, it regenerates.
That's the crux of the problem, it's the same as why an article with a <DPL> tag won't update unless you purge the page or perform an edit. However, there may be a workaround.
MediaWiki stores template relationships in the templatelinks table, and the ParserOutput class's addTemplate() method can be used to create such a relationship, even if the article doesn't actually transclude the specified page.
So, if the {{#dpl:}} parser function would do a $parser->mOutput->addTemplate() call for the category being dynamically queried, it may be enough to signal to MediaWiki that changes to the category should force the article (and tangentially, WikiArticleFeeds) to re-render. I think it's worth a shot. --Jimbojw 19:08, 17 July 2008 (CEST)