[pmwiki-users] Conditional Expression Help for ZAP forms

Sivakatirswami katir at hindu.org
Tue Dec 12 15:13:43 CST 2006


OK I did my home work.. studied the conditionals section of the docs.
Patrick thanks for all the incredible effort to document these tools!

I was not quite able to grok the algorithm for (in xTalk)

if (condition A is true) then
     # do command X
   else
     # do command Y
end if

So I just wrote a series of explicit conditionals,
which of course works but is not the most efficient...

  # only write a new page if it is a new entry
(:if ! equal {$Group} 'TODO-{$Project}':)
    (:input hidden datapage TODO-{Project}.#:)
(:ifend:)

# get value for backlink from current location
(:if group -TODO*:)
     (:input hidden returnpage "{$FullName}":)
(:ifend:)

# repoke existing value for backlink from data on this page
# otherwise ZAP will zero out the field, because null is passed by default
(:if group TODO*:)
     (:input hidden returnpage "{$returnpage}":)
(:ifend:)

(:input hidden savedata 
"Project,Owner,Priority,Status,Description,returnpage":)
(:input submit value="Submit":)

1. Can someone show me the really "tight" way to write all that?
2. As "baby" programmer and using xTalk I tend to
not worry overly much about how "tight" to write things, because this
style is very readable later on. But... in this case I'm also concerned
about processing times... and if a terse version is faster, then it
would be better. I really don't know if the delay on form submissions
really has much to do with PHP speed which is probably only 10% of
time to screen update issue where 90% is the connectivity-roundtrip to
server...(Oh for a little AJAX in PMWiki!)

Sivakatirswami







More information about the pmwiki-users mailing list