[pmwiki-users] pagelist pagination

The Editor editor at fast.st
Wed May 16 16:07:58 CDT 2007


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...

If we redesigned the MarkupExpression to take an initial value (that
was passed to it via a pagelist variable $$start) and had it triggered
on every page like this you could generate 10-20. I'm also assuming
you pass in the $$end value as well via the pagelist:

[@
[[#test]]
(:template each:){(counter)}
(:if between 10 {(counter)} 20:)* [[{=$FullName}]](:if:)
[[#testend]]
@]

(Note you would probably need between 20 * 40 as counter would be
triggered twice each page...)

I've tried this out on my site and it seems to work...

Cheers,
Dan



More information about the pmwiki-users mailing list