[pmwiki-devel] how to access MatchCount from pagelist

Peter Bowers pbowers at pobox.com
Fri Feb 13 03:34:06 CST 2009


On Fri, Feb 13, 2009 at 9:45 AM, Hans <design5 at softflow.co.uk> wrote:

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

While the math could get a bit inconvenient I think that complexity can
entirely be hidden within the code and leave the pagelist parameter set
unchanged...  I guess I'm assuming a page editor is not going to be
specifying a given "chunk-page" -- they will just indicate somehow within
their pagelist that they want it to be "chunked" and from there on they will
click on a link...  Is that right?

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


That makes sense to me to have it as a PV.  I think I'd still lobby for
something related to the already-available $MatchCount or else change
$MatchCount from FmtV to FmtPV (Or add $FmtPV['$ThisMatchCount'] or the
like) -- just for consistency's sake.

-Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20090213/aee35078/attachment.html 


More information about the pmwiki-devel mailing list