[pmwiki-devel] markup timing and page variable

Patrick R. Michaud pmichaud at pobox.com
Mon Jul 7 12:50:31 CDT 2008


On Mon, Jul 07, 2008 at 05:29:21PM +0100, Hans wrote:
> 
> Can someone tell me please what the best markup timing (when to be
> processed) is for a markup directive which generates some display
> according to various calculations done in the markup function - and
> which should set a resulting value to a page variable, which could be
> shown on the same page.
> 
> I am just having second thoughts/questions about what I did in
> rater.php, the script just released with the star rating system
> http://www.pmwiki.org/wiki/Cookbook/StarRater
> 
> I set the markup timing to '_begin', because if I used 'directives' I
> did not get an output for the page variables defined in the markup
> function. And I want to avoid that a page variable or markup
> expression runs the function another time (a first time), so it is
> only run once for every matching markup directive encountered.

Setting things to '_begin' is a bit suboptimal, because this
means it can occurs even before [=...=] processing.

If you want to make sure that something happens before variable
processing, then set it to '<{$var}'.

There's also an argument to be made that using the markup to
set the page variable is somewhat incorrect, because it means
that '{OtherPage$RatingXYZ}'  isn't likely to work properly.
What should really happen is that the page variable should
work independently of the markup itself, which would really
solve the issue you're having altogether.

Hope this helps,

Pm



More information about the pmwiki-devel mailing list