|
Main sidebar
|
PITS /
00774Summary: Pagelist format not found behavior
Created: 2006-07-06 10:22
Status: Open
Category: Feature
From: Pico, MartinFick
Assigned:
Priority: 4432
Version:
OS:
Description: Currently, if a pagelist directive refers to a non-existent format, the directive returns the Site.PageListTemplates page (or whatever page is setup to be the last page searched), which can be confusing and unexpected. Stated another way, if a page contains the following pagelist directive: (:pagelist group=Main fmt=#nonexistentformat:)
The result will look the same as if the following pagelist were specified: (:pagelist group=Main fmt=Site.PageListTemplates :)
ResultsThe result is probably not what any user expects and does not really convey the feeling that the format was missing, but rather that some strange looping or include interaction is occuring. Assuming that the behavior could be changed, here are some alternatives that might be more understandable and expected:
MethodsAs for the methods for accomplishing these, here are some suggestions:
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;
}
(:if equal {<$Group}:)
[[#notfoundend]]
(:if equal {<$Group}:)
Inline message to be displayed when specified pagelist format not found.
[[#notfoundend]]
(:if:)
(:if equal {<$Group}:)
* [[{=$FullName}]]
[[#notfoundend]]
(:if:)
(:if equal {<$Group}:)
Message to be displayed
(:if ! equal {$Name} PageListTemplates:)
* [[{=$FullName}]]
[[#notfoundend]]
(:if:)
Note, there is more than one way to mess up a format parameter and the above discussion just addresses a couple of them (fmt=#nonexistent and fmt=#typo). Other ways to screwup a format include omitting the pound sign (fmt=simple) and misnaming the parameter frm=#simple), each of which should return a blank pagelist (unless, of course an existing page name is referenced, e.g. if a page called simple exists in the first example). Consistency with IncludesPm mentioned on this post to the list that This particular issue is probably also somewhat related to the issue of what to do when an author writes something like . 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. I note that an include to an existent page that specifies a non-existent anchor seems to behave the same as a pagelist, in that a reference to PageName#nonexistentanchor behaves like a reference to PageName#, in that both will stop including content when they encouter any anchor. I've often found myself frustrated by this. If I specify a nonexistent format then I'd like to be informed of it by error message. I've made a mistake and I should be told so I can fix it -- I can't imagine a situation where I entered a specific format and would want something else (using a default format, etc.) to happen. To me the error message is the only reasonable alternative -- anything else is just going to confuse people, I think...
|