Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post

    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>

  • #2
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post
    help

  • #3
    Regular Coder
    Join Date
    Oct 2009
    Location
    GERMANY
    Posts
    135
    Thanks
    29
    Thanked 1 Time in 1 Post
    heeelp!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •