[pmwiki-users] Again: looking to add more randomness

Patrick R. Michaud pmichaud at pobox.com
Sat Mar 4 11:23:10 CST 2006


On Fri, Mar 03, 2006 at 08:41:32PM -0500, Susan wrote:
> Any progress (or ETA) for this one?

Sure!

The Cookbook.RandomQuote page was becoming a real mess, so I just
redid the whole thing using the section-based approach I described
earlier in this thread [1].

Essentially I've just created a {$RandomSection} markup, which
looks at a page and grabs a random anchor from it.  This can
be used with the (:include:) directive to grab a random section
from out of a page.  Thus:

    (:include {Quotes$RandomSection}:)

will grab a random section out of the "Quotes" page of the current group.

The quotations page is then simply a list of quotations separated
by anchors.  The quotations can contain arbitrary wiki markup.
It's even possible to embed the quotations in different sections --
for example:

    >>rframe width=200px<<
    '''Quote of the day'''
    
    (:include {Quotes$RandomSection}:)
    >><<

places a random quote in a floating box on the right side of the page.

Enjoy!

Pm

1.  http://www.pmichaud.com/pipermail/pmwiki-users/2006-February/023237.html




More information about the pmwiki-users mailing list