Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-26-2009, 10:16 PM   PM User | #1
OGGordon
Regular Coder

 
Join Date: Oct 2009
Location: GERMANY
Posts: 134
Thanks: 29
Thanked 1 Time in 1 Post
OGGordon is an unknown quantity at this point
need help with category modification

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:





here's how i want it to be:




And here's the code:

PHP 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"
;





$resmysql_query($sql) or die(mysql_error());

$i 0;



while(
$row=mysql_fetch_array($res))

{

    
$i++;



    if (
$i%$dir_cols == || $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 is offline   Reply With Quote
Old 10-27-2009, 09:53 PM   PM User | #2
OGGordon
Regular Coder

 
Join Date: Oct 2009
Location: GERMANY
Posts: 134
Thanks: 29
Thanked 1 Time in 1 Post
OGGordon is an unknown quantity at this point
help
OGGordon is offline   Reply With Quote
Old 10-28-2009, 10:02 PM   PM User | #3
OGGordon
Regular Coder

 
Join Date: Oct 2009
Location: GERMANY
Posts: 134
Thanks: 29
Thanked 1 Time in 1 Post
OGGordon is an unknown quantity at this point
heeelp!!
OGGordon is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:25 PM.


Advertisement
Log in to turn off these ads.