Solved

Remove gap between directory listings

Posted on 2011-09-13
2
187 Views
Last Modified: 2012-05-12
Hi,


 Please take a look here -

 http://tinyurl.com/cityads

and then take a look at the link below

I want my category listings to display similar to this...

  http://imageshack.us/photo/my-images/833/catdisplay.png/


That is each category listing is immediately followed by another one without too much gap.

As you can see in the current site, each column for category listing is of similar height.. so when a category has lesser number of sub-categories, the gap between the two listings becomes too wide.

I'm attaching below the php code that outputs the css code displsying the lists... The exact code that outputs css is highlighted in bold.   The respective style classes/tags are provided as well.


while($rowcat=mysql_fetch_array($rescats))
{
   if ($cnt >= $thiscolcats)
   {
       $col++;
       $thiscolcats = ($col > $longcols) ? $percol_short : $percol_long;
       $cnt = 0;
       
       echo "<td valign=\"top\" width=\"$cell_width%\">";
   }

   $count++;
   $cnt++;

    $catlink = buildURL("ads", array($xcityid, $rowcat['catid'], $rowcat['catname']));
    

   $adcount = 0+$catadcounts[$rowcat['catid']];

?>

   <div class="left_2" id="left_2">
   <div class="content_title" >
   <img src="images/category.gif" border="0" align="absmiddle">
   <a href="<?php echo $catlink; ?>"><?php echo $rowcat['catname']; ?></a>
   <?php if($show_cat_adcount) { ?><span class="count">(<?php echo $adcount; ?>)</span><?php } ?>
   </div>
   
   <hr align="left" class="content_line"/>
   
   
   
   
                         
   
   
   
   

<?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");
 
   $subcatcount = mysql_num_rows($ressubcats);

   while ($rowsubcat = mysql_fetch_array($ressubcats))
   {

       if ($shortcut_categories && $subcatcount == 1
               && $rowsubcat['subcatname'] == $rowcat['catname']) {
           continue;
       }
   
       
       $adcount = 0+$subcatadcounts[$rowsubcat['subcatid']];

   
       $subcat_url = buildURL("ads", array($xcityid, $rowcat['catid'], $rowcat['catname'],
           $rowsubcat['subcatid'], $rowsubcat['subcatname']));
   

?>
           
       <table width="130px"><tr><td align="left" valign="top"><a href="<?php echo $subcat_url; ?>"><?php echo $rowsubcat['subcatname']; ?></a>
       <?php if($show_subcat_adcount) { ?><span class="count">(<?php echo $adcount; ?>)</span></td></tr></table><?php } ?>
       
       
       
       

<?php


   }
   


   
?>
   
</div>    





Css inside external css file:


#main_content { width:59%; height:auto;float:left;  }

.content_title {padding:2%; text-align:center; color:#BB532E;font-weight:bold;font-size:95%;font-family:Arial, Helvetica, sans-serif; }

.left_2 { margin-left:3%; width:23.5%; height:auto; float:left; }

Open in new window

0
Comment
Question by:ee-itpro
2 Comments
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 36531849
Would you be after something like this?
http://masonry.desandro.com/
0
 

Author Closing Comment

by:ee-itpro
ID: 37116720
not a solution to my problem but appreciate the help.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now