[pmwiki-users] Conditional Extensions

Fick, Martin fick at fgm.com
Thu Sep 15 21:38:43 CDT 2005


OK, for anyone lese trying this, I messed with 
this for a while beating my head @##$$!.  There 
is a typo, this should read:

$Conditions['equal'] = 'condequal($condparm)';

function condequal($condparm) {
  $args = ParseArgs($condparm);
  return @($args[''][0] == $args[''][1]);
}

Notice the restored 'ual' in the first line. :)

-Martin

-----Original Message-----
From: Patrick R. Michaud [mailto:pmichaud at pobox.com]
Sent: Thu 9/15/2005 8:16 PM
To: Fick, Martin
Cc: PmWiki
Subject: Re: [pmwiki-users] Conditional Extensions
 
On Thu, Sep 15, 2005 at 05:22:13PM -0400, Martin Fick wrote:
> Has there been any thought to creating conditional
> extensions that would include == and != ?

Sure, one can define an "equal" condition as

    $Conditions['equal'] = 'condeq($condparm)';

    function condequal($condparm) {
      $args = ParseArgs($condparm);
      return @($args[''][0] == $args[''][1]);
    }

and then conditions can look like:

    (:if equal {$Group} PmWiki:)   Group is PmWiki
    (:if !equal {$Group} PmWiki:)  Group is not PmWiki
    (:if equal {$AuthId} johnny:)  Authorized user is "johnny"

See http://www.pmwiki.org/wiki/Test/Equality for an example.

It might even be worthwhile to add this to the core.  :-)

Pm

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20050915/ee190f9f/attachment.html 


More information about the pmwiki-users mailing list