[dokuwiki] Re: My first dokuwiki plugin does not work quite well

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 26 Jan 2007 00:01:46 +0000

Lorenzo Ferrara wrote:
Andreas Gohr ha scritto:
On Fri, 26 Jan 2007 00:08:14 +0100
Lorenzo Ferrara <lorenzojr_82@xxxxxx> wrote:

Feed2DokuWiki is the first plugin I've written. It parses a remote xml
feed and prints it in a wiki page. The feed is parsed using magpierss.
What is wrong with {{rss>http://www.example.com/feed.xml}} ?

See http://wiki.splitbrain.org/wiki:rss


That is great! But I would like to understand the problems in my
plugin... for the next one...

Tanks

Lorenzo Ferrara

P.S.
Next time I can't find a plugin, before I try to develop it, I'll ask in
the mailing list.
RSS isn't a plugin but native DokuWiki.

I can't say why your plugin broke the page, especially since you've taken down the example page.

For details on how plugins work check out the tutorial at splitbrain and also read the page on the parser. To summarise the issue you've encountered. DokuWiki has a three stage process for generating the final xhtml.

raw wiki page
dokuwiki instructions
rendered xhtml

the instructions are generated once after the page is edited. those instructions are then uses repeatedly to generate the xhtml page. The xhtml page itself is cached and will only be regenerated if its older than your cache configuration setting or one of its dependencies has changed.

what this means is there is a disconnect between handle() and render(). Render can only work on data passed into it via its parameters. It can't assume that object properties were previously set by handle() - as handle most likely ran hours/minutes/days ago. So the reason it worked on preview and the first time after cache deletion was that you were forcing a circumstance when handle() and render() did run together.

All of this and much more is explained in the tutorial.

Cheers,

Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: