[pmwiki-users] List of Categories in use
Mikael Nilsson
mini at nada.kth.se
Mon Dec 12 04:19:29 CST 2005
sön 2005-12-11 klockan 22:02 -0600 skrev Patrick R. Michaud:
> > Ooh! This might play into a feature I've been wanting for some time!
> > It's not urgent, but it's a very wiki sort of feature. Instiki has
> > AllPages, a super-sitemap which lists not only existing pages, but
> > *also* orphaned pages and wanted pages (ones that don't exist, but
> > ought to).
>
> I can come up with a couple of places where this would be quite useful.
> Any suggestions as to what the option to (:pagelist:) ought to be
> named for this (i.e., fill in the '???' below):
>
> (:pagelist ???=missing:) # wanted pages
> (:pagelist ???=orphans:) # pages w/o references
How about just special=missing?
While on the subject of pagelists, I've come across a number of
situations where I've wanted to tailor the pagelist display. Today,
there are essentially two approaches (correct me if I'm wrong):
1. Use fmt=simple, and modify the $FPLSimpleIFmt variable (and related
variables).
2. Create a new formatting function, add it to $FPLFunctions, etc.
Now, the problem with 2. is that it is much too complicated for a
pagelist that occurs on a single page. The problem with 1. is that you
can only have one format site-wide.
Now, I'd like to propose a third variant: (:pagelist fmt=custom
style=myown ... :) (stupid syntax example).
This would essentially be:
function FPLCustom($pagename, &$matches, $opt) {
global $FPLCustomStartFmtA, $FPLCustomIFmtA, $FPLCustomEndFmtA, $FPLCustomOptA;
SDV($FPLCustomStartFmtA['default'], "<ul class='fplcustom'>");
SDV($FPLCustomEndFmtA['default'], "</ul>");
SDV($FPLCustomIFmtA['default'], "<li><a href='\$PageUrl'>\$FullName</a></li>");
SDVA($FPLCustomOptA['default'], array('readf' => 0));
$customrule = (@$opt['style']) ? $opt['style'] : 'default';
$customopt = (@$FPLCustomOptA[$customrule]) ? $FPLCustomOptA[$customrule] : $FPLCustomOptA['default'];
$customstart = (@$FPLCustomStartFmtA[$customrule]) ? $FPLCustomStartFmtA[$customrule] : $FPLCustomStartFmtA['default'];
$customend = (@$FPLCustomEndFmtA[$customrule]) ? $FPLCustomEndFmtA[$customrule] : $FPLCustomEndFmtA['default'];
$customi = (@$FPLCustomIFmtA[$customrule]) ? $FPLCustomIFmtA[$customrule] : $FPLCustomIFmtA['default'];
$topt['order'] = (@$opt['trail']) ? '' : 'name';
$matches = MakePageList($pagename,
array_merge($topt, (array)$customopt, $opt));
if (@$opt['count']) array_splice($matches, $opt['count']);
$out = array();
foreach($matches as $pc)
$out[] = FmtPageName($customi, $pc['pagename']);
return FmtPageName($customstart, $pagename) . implode('', $out) .
FmtPageName($customend, $pagename);
}
$FPLFunctions['custom'] = 'FPLCustom';
And in config.php, for an ordered list:
$FPLCustomStartFmtA['myown'] = "<ol class='myown'>";
$FPLCustomEndFmtA['myown'] = "</ol>";
and in a wiki page:
(:pagelist fmt=custom style=myown group=Main:)
It works! but I'm unsure about all the details... It's a hack.
What do you think?
/Mikael
--
Plus ça change, plus c'est la même chose
More information about the pmwiki-users
mailing list