On Wed, May 16, 2007 at 05:07:58PM -0400, The Editor wrote:
> Not a finished solution by any means but a proof of concept kind of idea:
> 
> [@
> [[#test]]
> (:template each:)
> (:if lt 10 {(counter)}:)* [[{=$FullName}]](:if:)
> [[#testend]]
> @]
> 
> $MarkupExpr['counter'] = 'MkExpExtCounter()';
> function MkExpExtCounter() {
>       global $ZAPcounter;
>       $ZAPcounter = $ZAPcounter + 1;
>       return $ZAPcounter;
>       }
>       
> $Conditions['lt'] = 'ZAPcompare($condparm)';
> function ZAPcompare($x) {
>       $x = trim($x);
>       $first = substr($x, 0, strpos($x, " "));
>       $second = substr($x, strpos($x, " ") + 1);
>       if ($first > $second) return true;
>       return false;
>       }
> 
> Seems to work great for me...

...granted that this isn't a "finished solution", I don't
see how it can be used to pose the original problem I posed [1] --
namely to be able to count sections that are controlled by
(:if:) conditions.  In particular, how can someone use 
{(counter)} with something like

    [[#mytemplate]]
    (:if auth edit {=$FullName}:)
    * {=$FullName}
    [[#mytemplateend]]

such that only the first ten pages for which the visitor
has edit permission are displayed.

[1]  http://www.pmichaud.com/pipermail/pmwiki-users/2007-May/043190.html

(I think that Hans is correct that this implementation is
effectively the same as the existing {$$PageCount} variable.)

Pm

_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to