[pmwiki-users] ZAP conditional syntax

The Editor editor at fast.st
Wed Mar 7 20:48:38 CST 2007


While I'm at it, (working on some new stuff for ZAP over the next
couple days), I wanted to ask a quick question to see if anyone has
any suggestions for syntax of the zap conditional processing (and form
validation also).

Currently it looks like:

(:zap if="condition||field|value":)

One problem is, the single pipe | causes conflicts with several zap
commands, as I tend to use that as a standard delimiter.  Though it
would break existing forms markup, it would be easy enough to change
it to:

(:zap if="condition||field=value":)

However I'm inclined to go farther (might as well do it all in one
step) and get rid of the double pipe.  First it looks confusingly like
the "or" operator, and second of all it looks like tables.  Someone
suggested (:zap if="condition?field=value":).  I like it, but I need
some way to distinguish it from question marks used in the condition
(such as pattern matching for forms validation).  Perhaps (:zap
if="condition=?=field=value":) but then it's getting clunky.

On the other hand, it occurs to me now, if I stick with the doublepipe
it would be fairly easy to get ZAP to recognize both (:zap
if="condition||field|value":) and (:zap if="condition||field=value":)
giving users a chance to upgrade their forms more gradually.

Also, I had hoped to allow multiple actions to occur when a condition
is passed, something like this:

(:zap if="condition||field=value,field=value,field=value":)

The only problem is--commas are pretty common, which would make it
impossible to really explode the field value pairs by that character.
Meaning it's use would be severely limited or subject to potential
bugs. One can do multiple if statements where the same condition is
tested and different actions are run each time, but it is less
efficient, so I'm looking for input.

Don't probably need help with the coding at this point, just some
syntax suggestions.  Your input is appreciated...

Cheers,
Dan



More information about the pmwiki-users mailing list