[pmwiki-users] Great pagelist question...

Stirling Westrup sti at pooq.com
Wed Aug 30 20:25:54 CDT 2006


Ralph Zeller wrote:

> Another admittedly-gratuitous feature that I would like to see is some
> rudimentary form of doing math with page variables.  Or would it be
> better just to use embedded PHP code somehow?  When I set up the 
> example at FASTData/ProgrammingDocumentation, I noticed a similarity to
> an invoice form.
> 
> (example markup)
> 
> :a: 3
> :b: 2
> :c: cats
> :d: (:math {$:a} + {$:b} :)
> 
> Oh no, we have {$:d} {$:c}!
> ----
> (resulting page)
> 
> Oh no, we have 5 cats!

That's a big kettle of fish there. It couldn't use straight PHP because
that would be a security nightmare. It would need to use something like
the invokable functions that PM mentioned he was thinking of in a
previous post. The trouble is, how far do you go down that route?

I've sometimes wanted a feature in a text-page where I could have it add
up a column of numbers for me, or do math on other numbers I've embedded
in the running text.

That starts to look like the need to add "floating-cells" as in some
fancy word-processors that act like addressable spreadsheet cells. It
might let you do things like:

  We used to have {{a| 3}} cats but then we got {{b|2}} cats more and
  now we have {{c| $a+$b}} cats!

  The numbers used on this page add up to {{Sum($a..$c)}}, not that that
  means anything.

Note that I'm not for a second proposing this feature, nor the markup I
used.




More information about the pmwiki-users mailing list