[Pmwiki-users] grouplist script such as it is.
Ross Kowalski
educoop at edu-coop.org
Wed Jun 11 11:08:39 CDT 2003
I have not had a change to make the grouplist code ahhh, how shall we
say...Good. Here is what I am using right now.
<?php
SDV($InlineReplacements['/\\[\\[\\$Grouplisth\\s*(.*)\\]\\]/e'],
"' '.FmtGrouplistH('$pagename').' '");
SDV($InlineReplacements['/\\[\\[\\$Grouplistv\\s*(.*)\\]\\]/e'],
"' '.FmtGrouplistV('$pagename').' '");
function FmtGrouplistV($pagename)
{
global $WikiDir,$ScriptUrl;
$dir = $WikiDir;
$dirp = @opendir($dir); if (!$dirp) return $out;
$filelist = array();
$lthegroup = "null";
while (($file=readdir($dirp)) !== false)
{
if ($file[0]=='.') continue;
$filelist[$file] = $file;
}
closedir($dirp);
asort($filelist);
$output = array();
foreach($filelist as $thefile)
{
list($thegroup,$thepage) = split('\.',$thefile);
if($thegroup!=$lthegroup)
{
$output[$thefile] = $thegroup;
$lthegroup = $thegroup;
}
}
foreach($output as $file)
{
$out .= "<a href=$ScriptUrl/$file/WelcomePage><font
size=2>$file</font></a><BR>";
}
return $out;
}
function FmtGrouplisth($pagename)
{
global $WikiDir,$ScriptUrl;
$dir = $WikiDir;
$dirp = @opendir($dir); if (!$dirp) return $out;
$filelist = array();
$lthegroup = "null";
while (($file=readdir($dirp)) !== false)
{
if ($file[0]=='.') continue;
$filelist[$file] = $file;
}
closedir($dirp);
asort($filelist);
$output = array();
foreach($filelist as $thefile)
{
list($thegroup,$thepage) = split('\.',$thefile);
if($thegroup!=$lthegroup)
{
$output[$thefile] = $thegroup;
$lthegroup = $thegroup;
}
}
foreach($output as $file)
{
$out .= "<a href=$ScriptUrl/$file/WelcomePage>$file</a> ";
}
return $out;
}
?>
More information about the pmwiki-users
mailing list