[pmwiki-devel] how to access MatchCount from pagelist

Hans design5 at softflow.co.uk
Fri Feb 13 02:45:14 CST 2009


Friday, February 13, 2009, 7:42:44 AM, Peter wrote:

> On Fri, Feb 13, 2009 at 7:40 AM, Peter Bowers <pbowers at pobox.com> wrote:


> Since pagelist already supports a count=21..40 type of syntax, what does the
> start= parameter add?

It adds convenience. It makes it easier to set a pagelist chunk. You
just need to calculate the start value, and supply the count value.
So it simplifies the math involved.

It will still not be easy to construct a dynamic link navigation
like (Go to page 1 2 3 ....)
within a custom template. But it just may be possible.

For a general breakpagelist recipe I think we still require an
additional pagelist to supply the pagelist count, which the script
will use to calculate the range parameters for the actual pagelist
(the one which produces formatted output).

>>
>> I think all that's needed is this line:
>>
>> $FmtV['$AllMatchCount'] = count($matches);
>>
>> But this must occur *before* $opt['count'] processing.
>>
>>
> Hmmm...  In retrospect maybe this line should occur at the end of
> MakePageList() so that any other FPL functions can depend on it as well...

> (BTW I'm not picky on the name of the variable -- $AllMatchesCount or
> $AllMatches or $PageListCount or whatever.  I just think it would be good to
> differentiate between $MatchCount which respects the count=x..y and this new
> variable that doesn't respect that parameter.

I suggested    $FmtPV['$PageListCount'] = $PageListCount;
I am not picky on the name either, but I thought we need a PV for use
in a pagelist template.

Other custom FPLFormat functions can use count($matches) to
get the count.


Hans




More information about the pmwiki-devel mailing list