questo è il codice completo della pagina main e sotto la pagina include... non sono una cime, quindi ogni aiuto è ben gradito
MAIN
<?php
/*--------------------------------------------------+
| X-ZERO COMMUNITY CLASSIFIEDS SCRIPT |
+===================================================+
| File: main.php |
| Homepage with the directory |
require_once("initvars.inc.php");
require_once("config.inc.php");
?>
<?php //include("welcome.inc.php"); ?>
<div class="categorytablewrapper">
<table id="categories" class="categories">
<tbody><tr>
<?php
// Create main directory
if($dir_sort)
{
$sortcatsql = "ORDER BY catname";
$sortsubcatsql = "ORDER BY subcatname";
}
else
{
$sortcatsql = "ORDER BY pos";
$sortsubcatsql = "ORDER BY scat.pos";
}
// First get ads per cat and subcat
$subcatadcounts = array();
$catadcounts = array();
$sql = "SELECT scat.subcatid, scat.catid, COUNT(*) as adcnt
FROM $t_ads a
INNER JOIN $t_subcats scat ON scat.subcatid = a.subcatid AND ($visibility_condn)
INNER JOIN $t_cats cat ON cat.catid = scat.catid
INNER JOIN $t_cities ct ON a.cityid = ct.cityid
WHERE scat.enabled = '1'
$loc_condn
GROUP BY a.subcatid";
$res = mysql_query($sql) or die(mysql_error().$sql);
while($row=mysql_fetch_array($res))
{
$subcatadcounts[$row['subcatid']] = $row['adcnt'];
$catadcounts[$row['catid']] += $row['adcnt'];
}
// Categories
$sql = "SELECT catid, catname AS catname FROM $t_cats WHERE enabled = '1' $sortcatsql";
$rescats = mysql_query($sql) or die(mysql_error());
$catcount = chiocciolamysql_num_rows($rescats);
$percol_short = floor($catcount/$dir_cols);
$percol_long = $percol_short+1;
$longcols = $catcount%$dir_cols;
$i = 0;
$j = 0;
$col = 0;
$thiscolcats = 0;
while($rowcat=mysql_fetch_array($rescats))
{
if ($j >= $thiscolcats)
{
$col++;
$thiscolcats = ($col > $longcols) ? $percol_short : $percol_long;
$j = 0;
echo "<td id=\"column_$col\" valign=\"top\" width=\"$cell_width%\">";
}
$i++;
$j++;
$catname_inurl = RemoveBadURLChars($rowcat['catname']);
if($sef_urls) $catlink = "{$vbasedir}$xcityid/posts/$rowcat[catid]_{$catname_inurl}/0/";
else $catlink = "?view=ads&catid=$rowcat[catid]&cityid=$xcityid&lang=$xlang";
$adcount = 0+$catadcounts[$rowcat['catid']];
?>
<div class="category">
<div class="catbuffer">
<?php //$category_icon = file_exists("images/category/{$rowcat[catid]}.gif") ? "images/category/{$rowcat[catid]}.gif" : "images/category.gif"; ?>
<div class="catimage cat<?php echo $rowcat[catid]; ?>"><!--<img src="<?php //echo $category_icon; ?>" border="0" align="absmiddle">--></div>
<div class="caturl"><a class="maj" href="<?php echo $catlink; ?>"><?php echo $rowcat['catname']; ?></a>
<?php if($show_cat_adcount) { ?><span class="count">(<?php echo $adcount; ?>)</span><?php } ?></div>
</div>
<?php if($show_subcat) { ?>
<div class="catsublinks">
<?php
$sql = "SELECT scat.subcatid, scat.subcatname AS subcatname
FROM $t_subcats scat
WHERE scat.catid = $rowcat[catid]
AND scat.enabled = '1'
$sortsubcatsql";
$ressubcats = mysql_query($sql) or die(mysql_error()."<br>$sql");
while ($rowsubcat = mysql_fetch_array($ressubcats))
{
$adcount = 0+$subcatadcounts[$rowsubcat['subcatid']];
if($sef_urls) $subcat_url = "{$vbasedir}$xcityid/posts/$rowcat[catid]_{$catname_inurl}/$rowsubcat[subcatid]_". RemoveBadURLChars($rowsubcat['subcatname'])."/";
else $subcat_url = "?view=ads&catid=$rowcat[catid]&subcatid=$rowsubcat[subcatid]&cityid=$xcityid&lang=$xlang";
?>
<a href="<?php echo $subcat_url; ?>"><?php echo $rowsubcat['subcatname']; ?></a>
<?php if($show_subcat_adcount) { ?><span class="count">(<?php echo $adcount; ?>)</span><?php } ?>
<br />
<?php
}
?>
</div>
<?php } ?>
</div>
<?php
if($j==$thiscolcats || $i==$catcount) echo "</td>";
}
?>
</tr></tbody></table>
</div>
<?php include_once("latest_featured.inc.php"); ?>
<?php include_once("upcoming_featured_events.inc.php"); ?>
<?php include_once("latest.inc.php"); ?>
<?php include_once("upcoming_events.inc.php"); ?>