[pmwiki-users] Suggested pagelist.php fix (formely Pagelist Extensions)

Martin Fick mogulguy at yahoo.com
Tue Jul 18 00:18:40 CDT 2006


--- Martin Fick <mogulguy at yahoo.com> wrote:
...
> lower case 'l's)!  The page with the uppercase 'L'
> is
> picked when fmt=#tasks is used and you do not have a
> #tasks defined on that page so you get garbage.  


Patrick,

I suspect that this loop in the pagelist.php script
does not quite do what you intended it to do:

  foreach ($tname as $t) {
    $t = FmtPageName($t, $pagename);
    if (!PageExists($t)) continue;
    if ($qf) $t .= "#$qf";
    $ttext = IncludeText($pagename, $t, true);
    if (!$qf || strpos($ttext, "[[#$qf]]") !== false)
break;
  }

When this loop is exitted through a break, the
template has been found and $ttext is appropriately
set, but when the execution falls off the end of the
loop, it is not usually appropriately set and should
probably be blanked out.

The reason I say usually is because I guess there is
one case where it might be appropriate, the case where
someone supplies a fully qualified pagename with an
anchor that does not exist.  In this case the loop
will not break out and the entire contents of the
fully qualified page will be included (just as it is
with a regular include).

But in all the other cases, if the loop drops off, it
simply includes the entire contents of the last page
in the $FPLTemplatePageFmt array which I hardly think
is what any user would expect.

Since I don't think that anyone would feel slighted if
even in the one 'appropriate' case the template were
simply considered empty, might I suggest adding a
$ttext = ''; as the last line of the loop?

-Martin


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the pmwiki-users mailing list