[pmwiki-users] New Cookbook: RandomQuoteWiki
Christophe David
pmwiki at christophedavid.org
Tue Aug 2 04:00:38 CDT 2005
Question : How can I display a random quote from a list stored in a PmWiki
page, and not from a flat file that I cannot access easily ?
Answer: Copy RandomQuoteWiki.php to the cookbook directory and add
include_once("cookbook/RandomQuoteWiki.php"); to config.php.
This script adds two markups (:RandomQuoteWiki_quote:) and
(:RandomQuoteWiki_author:) that contain a random quote stored in a pmwiki
page (instead of a flat file that cannot be accessed by most users).
The quotes must be structured like
<quotes>
<quote>
<text>quote text 1</text>
<author> quote author 1</author>
</quote>
<quote>
<text>quote text 2</text>
<author>quote author 2</author>
</quote>
...
</quotes>
To use this script, simply copy it into the cookbook/ directory and add
the following line to config.php or a per-page/per-group customization
file.
include_once('cookbook/RandomQuoteWiki.php');
Then add something like
|| '''(:RandomQuoteWiki_quote:)''' ||
|| (:RandomQuoteWiki_author:) ||
in your wiki page.
---
Comments welcome.
Christophe
More information about the pmwiki-users
mailing list