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

Patrick R. Michaud pmichaud at pobox.com
Wed Jul 19 10:14:21 CDT 2006

On Mon, Jul 17, 2006 at 10:18:40PM -0700, Martin Fick wrote:
> 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.

I know that there have been later replies in this
thread, but it's easier for me to reply to the original.

I don't think that "blanked out" is the correct answer here;
many people would then interpret this as "the (:pagelist:)
directive is being ignored" and not relate the issue to
the incorrect fmt= parameter.  

This particular issue is probably also somewhat related to
the issue of what to do when an author writes something like
(:include PageName#nonexistentanchor:).  Currently PmWiki
includes the entire page, although some have argued it should
either return nothing or return an error message.  I think
we should have some consistency between the two.

At any rate, I think that returning "blank" can be very
confusing, because it makes it appear as though nothing
has happened and that the (:pagelist:) was completely
ignored.  The suggestion to have a Site.PageListNotFound
entry at the end of the list of pages to be searched
makes a lot of sense, however.  (I'll have to think about it
just a bit more before committing it to a distribution.)


More information about the pmwiki-users mailing list