[pmwiki-devel] FmtPV[] defined in markup function?

Hans design5 at softflow.co.uk
Thu Apr 26 14:13:01 CDT 2007


Thursday, April 26, 2007, 7:42:04 PM, Hans wrote:

> "Test" is just to illustrate. It will be a number calculated
> inside the function.

Maybe there is a better way to approach the problem:

I am working to polish a opinion poll/rating script.
Sums of voted options and weights of those options are held in the
page in PTVs. The script reads these and calculates a total vote and a
weighted total. This is returned as page variables and can be
displayed in various ways graphically.

It all works if I just include the php code. But I wanted to have this
included only for the page it is relevant for, but without having to
set this in local/Group.PageName.php, as a user may use it on any page.

So I thought to be clever (never a good sign!) and use a markup
directive, so the code will only be used with the directive in the
page. But as I see I cannot define the PVs this way. I suppose they
need to be defined before.

So a different question may be how to use a markup directive to have
php code included only with this markup present in the page.

Or: I though of using in php:

if(PageTextVar($pagename, 'PTVName')) {
...code here for...
}

but this will run PageTextVar for any page browsed, which seesm not
too clever either.


Hans




More information about the pmwiki-devel mailing list