/*
Il file index è strutturato
in questo modo:
id\tdescrizione\tnumeroPosts
*/
function getFile($fileIndex)
{
$trimContent = array();
$content = file($fileIndex);
foreach($content as $rows)
{
$trimContent[]=trim($rows);
}
return $trimContent;
}
function getIndex($fileIndex)
{
$newcontent = array();
$content = getFile($fileIndex);
foreach($content as $rows)
{
list($id)=explode("\t",$rows);
$newcontent[$id] = stripslashes($rows);
}
return $newcontent;
}
$menu = getIndex(DATA."cats.index");
$path = $_SERVER['PHP_SELF'];
echo "<ul>\n";
foreach($menu as $rowCat)
{
list($idM,$titleM,$postsM)=explode("\t",$rowCat);
if(isset($_GET['cat']))
{
if($idM==$getCat)
{
echo "[*]<a id=\"current\" href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
}
else
{
echo "[*]<a href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
}
}
elseif(isset($_GET['view']))
{
if(safeUrl($getView,$maxP))
{
echo "[*]<a href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
}
else
{
$indexMenu = $userData->getIndexById(DATA."posts.index",$getView);
list($idIndexM,$titleIndexM)=explode("\t",$indexMe nu);
if($idM==$idIndexM)
{
echo "[*]<a id=\"current\" href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
}
else
{
echo "[*]<a href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
}
}
}
else
{
echo "[*]<a href=\"".$path."?cat=".$idM."\">".$titleM."(".$pos tsM.")</a>\n";
}
}
echo "[/list]\n";