...

View Full Version : need help with category modification



OGGordon
10-26-2009, 10:16 PM
I want to add a background to the category title and split the subcategories in 2 columns and I'm not sure how to do it. Here's what it looks like right now:

http://forum.e46fanatics.com/attachment.php?attachmentid=336138&stc=1&d=1256317504



here's how i want it to be:

http://forum.e46fanatics.com/attachment.php?attachmentid=336139&stc=1&d=1256317518


And here's the code:


?>



<h2><img src="images/category.gif" align="absmiddle"> <?php echo $xcatname; ?></h2>



<table border="0" cellspacing="1" cellpadding="2" width="100%" class="dir_cat">



<?php



// Directory



if($dir_sort)

{

$sortsubcatsql = "ORDER BY subcatname";

}

else

{

$sortsubcatsql = "ORDER BY pos";

}





// First get ads per subcat

$subcatadcounts = array();

$sql = "SELECT scat.subcatid, COUNT(*) as adcnt

FROM $t_ads a

INNER JOIN $t_subcats scat ON scat.subcatid = a.subcatid AND ($visibility_condn)

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'];

}





// Subcategories



$sql = "SELECT scat.subcatid, scat.subcatname AS subcatname

FROM $t_subcats scat

WHERE scat.catid = $xcatid

AND scat.enabled = '1'

$sortsubcatsql";





$res= mysql_query($sql) or die(mysql_error());

$i = 0;



while($row=mysql_fetch_array($res))

{

$i++;



if ($i%$dir_cols == 1 || $dir_cols == 1) echo "<tr>";



$adcount = 0+$subcatadcounts[$row['subcatid']];



if($sef_urls) $subcat_url = "{$vbasedir}$xcityid/posts/$xcatid/$row[subcatid]_" . RemoveBadurlChars($row['subcatname']) . "/";

else $subcat_url = "?view=ads&catid=$xcatid&subcatid=$row[subcatid]&cityid=$xcityid&lang=$xlang";



?>



<td width="<?php echo $cell_width; ?>%">

<a href="<?php echo $subcat_url; ?>">

<?php echo $row['subcatname']; ?></a>

<span class="count">(<?php echo $adcount; ?>)</span><br>

</td>



<?php



if ($i%$dir_cols == 0) echo "</tr>";



}



?>



</table>

OGGordon
10-27-2009, 09:53 PM
help :(

OGGordon
10-28-2009, 10:02 PM
heeelp!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum