[Pmwiki-users] Re: random signatures or quotes (random anything ; )

Thomas -Balu- Walter list+pmwiki-users
Wed May 5 14:58:23 CDT 2004


On Tue, May 04, 2004 at 12:11:46AM +0200, Albi Rebmann wrote:
> Thomas -Balu- Walter schrieb:
> 
> >No comments so far?
> 
> Nice tool. I like it, but it would be great if I could add complete wiki 
> pages. That would be not difficult, if I can add 
> [[include:GroupName.PageName]] in the list, which is some function of 
> pmwiki. Only problem is, it will not be included, it just shows the text.
> Has anybody a idea how this change could be made?

I've changed the RandomQuote() to include the following lines:

    // make it possible to include pages as quote (TESTING)
    $TextBackup = $Text;
    $quote = $quotes[rand(0, $quotescount)];
    $quote = '[[include:Main/GuestBook]]';
    ProcessTextDirectives($pagename, $quote);
    $QuoteText = $Text;
    $Text = $TextBackup;

I am not sure if this creates any problems, because I am not exactly sure how
ProcessTextDirectives() works. But in a little test on my homepage it looks
like it is okay this way.

Pm, do you see any problems in this snippet?

The biggest problem was that ProcessTextDirectives() changes the global
variable $Text and overrides the usual page content... This is why I needed to
store the $Text inside $TextBackup.

See http://www.b-a-l-u.de/index.php/Projects/RandomQuote for the complete
code.

     Balu



More information about the pmwiki-users mailing list