[pmwiki-users] Conditional Extensions

Patrick R. Michaud pmichaud at pobox.com
Thu Sep 15 19:16:35 CDT 2005


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




More information about the pmwiki-users mailing list