[pmwiki-users] I need help with making my own pagelist function/format that returns include directives

Chris Cox ccox at airmail.net
Wed Aug 10 19:03:37 CDT 2005


I create my own pagelist fmt type.  I just took the Simple one and
started hacking it a bit.  The idea is to return the first few
lines of pages containing matches (I welcome anyone's code that
does this... I'm strictly hacking this).  Anyhow, if I remove
the lines=15 from the code snippet below, the includes seem
to get run and work.  Maybe it's not really working... and I'm
seeing some kind of twisted artifact... not sure.  Anyhow,
can I get some hints on how I should do this properly??


$FPLFunctions['cjc'] = 'CJCpl';

function CJCpl($pagename, &$matches, $opt) {
   global $FPLCjcStartFmt, $FPLCjcIFmt, $FPLCjcEndFmt, $FPLCjcOpt;
   SDV($FPLCjcStartFmt, "<ul class='fplsimple'>");
   SDV($FPLCjcEndFmt, "</ul>");
   SDV($FPLCjcIFmt, "<li><a href='\$PageUrl'>\$FullName</a></li>");
   SDVA($FPLCjcOpt, array('readf' => 0));
   $topt['order'] = ($opt['trail']) ? '' : 'name';
   $matches = MakePageList($pagename, array_merge($topt, $FPLCjcOpt, $opt));
   if (@$opt['count']) array_splice($matches, $opt['count']);
# simplified by getting rid of array.
#  $out = array();
   $out = "\n";
   foreach($matches as $pc) {
         $out = $out . "(:include " . trim($pc['pagename']) . " 
lines=15:)\n";
   }
#This works...  return "(:include Unix/Unix lines=15:)";
#The above works if I remove the lines=15
    return $out;

}





More information about the pmwiki-users mailing list