[pmwiki-devel] how to access MatchCount from pagelist

Peter Bowers pbowers at pobox.com
Fri Feb 13 03:07:49 CST 2009


On Thu, Feb 12, 2009 at 10:01 PM, Patrick R. Michaud <pmichaud at pobox.com>wrote:

> On Thu, Feb 12, 2009 at 09:41:30PM +0100, Peter Bowers wrote:
> >
> > I looked at this once before and came to the conclusion that either (a)
> you
> > have to call pagelist twice or (b) you have to copy FPLTemplate() and
> make some
> > alterations.  (This could be done as a recipe since $FPLFormatOpt holds
> this
> > function name.)
>
> ...or, if I'm wrong and it's not really possible to get to the matchcount
> easily, you can propose modifications to FPLTemplate() for the core.  :-)
>

With an invitation like that I'm not sure I can stay limited to just this
particular issue... :-)

Right now pagelist is constructed somewhat as a chain link.   FmtPageList
calls $fmtfn (usually FPLTemplate()) which calls makepagelist().  No ifs,
ands, or buts -- one calls the other which calls the last one.  As a result
there's very little possibility of any interaction in the process there...

If it were structured like this (function names intended for
self-documentation, not for actual use):

function DoAPageList()
{
   PageListOptionSetup();
   $matchlist = MakeListOfPages($selection_options);
   FormatPageList($matchlist, $formatting_options);
}

Then there would be some *very useful* functions available to recipes along
the way...

For instance, someone could construct 2 or 3 $matchlists, merge them
together, and then hand it off to FormatPageList().  Or someone could use
the pagelist options to get a $matchlist without having the format section
called at all.  Or someone could display the same pagelist in multiple
formats without having to go through the selection of pages multiple
times...  (Hans's current project would be a perfect example of this -- the
list of page-links to other chunks of the list wouldd simply be a format
which printed a page-number-link for every n pages listed.)  Basically it
*hugely* increases the flexibility of pagelists...

Basically what I'm suggesting (although this may be too big a change -- I
don't know what recipes may depend on the current implementation of FPL
functions) is to separate the functionality of a pagelist.  (a) Part of it
is setting up defaults and options.  Another part (b) is getting the
appropriate list of pages.  The last part (c) is actually formatting said
list.  Currently each function calls the next which means there's no
possible division of those 3 functions.  I'm lobbying for a mainline within
pagelist.php...

*If* something like this were to occur I would suggest that the
count=from..to be part of the *formatting* options rather than the
*selection* options for reasons already explored in this thread...

Having said that I should hasten to add that I recognize pagelist.php to be
a *very* tight and *highly* optimized piece of code and I recognize that the
changes I am suggesting are not cosmetic...  So if it's decided that this is
not prudent at this time I totally understand..

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


More information about the pmwiki-devel mailing list