function index() {
global $mpnTables, $phpEx, $myts, $eh, $sitename, $mf;
include("header.$phpEx");
$result=mysql_query("SELECT cid, title, imgurl FROM ".$mpnTables['classifieds_categories']." WHERE pid=0 ORDER BY title") or $eh->show("0013");
OpenTable();
$mainlink = 0;
mainheader($mainlink);
echo "<center><table border=0 cellspacing=5 cellpadding=0 width=\"90%\"><tr>";
$count = 0;
while($myrow = mysql_fetch_array($result)) {
$title = $myts->makeTboxData4Show($myrow['title']);
$imgurl = $myts->makeTboxData4Show($myrow['imgurl']);
$imgurl = urldecode($imgurl);
echo "<td valign=\"top\" align=\"right\">";
if ($myrow['imgurl']){
echo "<a href=classifieds.$phpEx?op=viewcat&cid=".$myrow['cid']."><img src=\"".$imgurl."\" height=\"50\" border=\"0\"></a>";
} else {
echo "";
}
$totalbiz = $mf->getTotalItems($myrow['cid'], 1);
echo "</td><td valign=\"top\" width=\"40%\"><font size=2><a href=classifieds.$phpEx?op=viewcat&cid=".$myrow['cid']."><b>$title</b></a> ($totalbiz)<br>";
// get child category objects
$arr=array();
$arr=$mf->getFirstChild($myrow['cid']);
$space = 0;
$chcount = 0;
foreach($arr as $ele){
$chtitle=$myts->makeTboxData4Show($ele->title);
if ($chcount>4){
echo "...";
break;
}
if ($space>0) {
echo ", ";
}
echo "<a href=classifieds.$phpEx?op=viewcat&cid=".$ele->cid.">".$chtitle."</a>";
$space++;
$chcount++;
}
if ($count<1) {
echo "</font></td>";
}
$count++;
if ($count==2) {
echo "</font></td></tr><tr>";
$count = 0;
}
}
echo "</font></td></tr></table></center>";
list($numrows)=mysql_fetch_row(mysql_query("select count(*) from ".$mpnTables['classifieds_business']." where status>0"));
echo "<br><br><center><font size=2>".translate("There are")." <b>$numrows</b> ".translate("Adds in our Database")." </center>";
echo "</font></basefont>";
CloseTable();
echo "<br>";
OpenTable();
echo "<div align=\"left\"><font size=\"3\"><b>".translate("Latest Listings")."</b></font><br><br>";
showNew("".$mpnTables['classifieds_business']."");
echo "</div>";
CloseTable();
include("footer.$phpEx");
}