[pmwiki-users] Great pagelist question...

Dominique Faure dominique.faure at gmail.com
Wed Aug 30 10:10:44 CDT 2006


On 8/30/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Wed, Aug 30, 2006 at 10:10:42AM -0400, Pico wrote:
> > >And this allows a pagelist template to use {=$RecipeSummary}
> > >to easily grab the "Summary:" lines from all of the pages
> > >in the list.
> >
> > [snip]
> >
> > I've been meaning to ask, and now seems like a good time: could we have
> > a look at the code that you used for the Cookbook so that it could be
> > turned into a recipe, or at least available for others to adapt to their
> > own sites.
>
> Yes, but I think I'm about to totally redo it based on the
> new markup just described.  It will likely replace PITS, also.  :-)
>

At the same time, could you please parametrize the variable evaluation
of pagelist template:

in pmwiki-2.1.18, scripts/pagelist.php(358):

    $item = preg_replace('/\\{(=|&[lg]t;)(\\$\\w+)\\}/e',
                "PageVar(\$pn, '$2', '$1')", $item);

Whatever the way this line of code would evolve, could we have both
the regexp and the replacement string being defined by global
variables, in order to avoid the duplication of the FPLTemplate
function when trying to improve (:pagelist:). More precisely and
refering to the code above, I was thinking of something like:

    global $FPLTemplateReplace;
    ...
    SDVA($FPLTemplateReplace, array(
    '' => array('pat' => '/\\{(=|&[lg]t;)(\\$\\w+)\\}/e',
                'rep' => "PageVar(\$pn, '$2', '$1')",
               ),
    ));
    foreach($FPLTemplateReplace as $r)
      $item = preg_replace($r['pat'], $r['rep'], $item);

Thanks,
Dom




More information about the pmwiki-users mailing list