Listing column spacing

2 posts by 2 authors in: Forums > CMS Builder
Last Post: August 31, 2011   (RSS)

By s2smedia - August 31, 2011

Im having a problem getting rid of unwanted spacing in a Listing.

HEre is the page.. roll to bottom of page (Entertainment)
http://test.rbvhlinwood.com/hospitalized.php

you will see their is a space above "Downtown RedBank"

Here is the code im using:

<div id="borderhead"><a name="hotels" id="hotels"></a>Pet-Friendly Hotels</div>
<div id="border2">

<div id="table2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<?php foreach ($hotel_dining_entertainmentRecords as $record): ?>
<?php if ($record['category'] != 'Hotel') { continue; } ?>
<th width="50%" align="left" valign="top" id="table2" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="5" align="left" valign="top" scope="col" style="padding:7px 0px 0px 0px"><img src="images/bullet.jpg" width="5" height="5" align="baseline" /></th>
<th align="left" valign="top" scope="col" style="padding:0px 0px 0px 8px; line-height:14px"><b style="font-size:14px"><?php echo $record['title'] ?></b>
<div style="font-weight:normal"><?php echo $record['address'] ?></div>
<div id="subtext4"><?php echo $record['description'] ?></div></th>
</tr>
</table>
</th> <?php $maxCols=2; if (@++$count % $maxCols == 0): ?>

</tr>
<tr>

<?php endif ?>


<?php endforeach; ?>
</table>

</div>
</div><br />
<div id="borderhead">Dining</div>
<div id="border2">

<div id="table2"> <table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<?php foreach ($hotel_dining_entertainmentRecords as $record): ?>
<?php if ($record['category'] != 'Dining') { continue; } ?>
<th width="50%" align="left" valign="top" id="table2" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="5" align="left" valign="top" scope="col" style="padding:7px 0px 0px 0px"><img src="images/bullet.jpg" width="5" height="5" align="baseline" /></th>
<th align="left" valign="top" scope="col" style="padding:0px 0px 0px 8px; line-height:14px"><b style="font-size:14px"><?php echo $record['title'] ?></b>
<div style="font-weight:normal"><?php echo $record['address'] ?></div>
<div id="subtext4"><?php echo $record['description'] ?></div></th>
</tr>
</table>
</th> <?php $maxCols=2; if (@++$count % $maxCols == 0): ?>

</tr>
<tr>

<?php endif ?>


<?php endforeach; ?>
</table></div>
</div><br />
<div id="borderhead">Coffee</div>
<div id="border2">

<div id="table2"> <table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<?php foreach ($hotel_dining_entertainmentRecords as $record): ?>
<?php if ($record['category'] != 'Coffee') { continue; } ?>
<th width="50%" align="left" valign="top" id="table2" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="5" align="left" valign="top" scope="col" style="padding:7px 0px 0px 0px"><img src="images/bullet.jpg" width="5" height="5" align="baseline" /></th>
<th align="left" valign="top" scope="col" style="padding:0px 0px 0px 8px; line-height:14px"><b style="font-size:14px"><?php echo $record['title'] ?></b>
<div style="font-weight:normal"><?php echo $record['address'] ?></div>
<div id="subtext4"><?php echo $record['description'] ?></div></th>
</tr>
</table>
</th> <?php $maxCols=2; if (@++$count % $maxCols == 0): ?>

</tr>
<tr>

<?php endif ?>


<?php endforeach; ?>
</table></div>
</div><br />
<div id="borderhead">Entertainment</div>
<div id="border2">

<div id="table2"> <table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<?php foreach ($hotel_dining_entertainmentRecords as $record): ?>
<?php if ($record['category'] != 'Entertainment') { continue; } ?>
<th width="50%" align="left" valign="top" id="table2" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="5" align="left" valign="top" scope="col" style="padding:7px 0px 0px 0px"><img src="images/bullet.jpg" width="5" height="5" align="baseline" /></th>
<th align="left" valign="top" scope="col" style="padding:0px 0px 0px 8px; line-height:14px"><b style="font-size:14px"><?php echo $record['title'] ?></b>
<div style="font-weight:normal"><?php echo $record['address'] ?></div>
<div id="subtext4"><?php echo $record['description'] ?></div></th>
</tr>
</table>
</th> <?php $maxCols=2; if (@++$count % $maxCols == 0): ?>

</tr>
<tr>

<?php endif ?>


<?php endforeach; ?>
</table></div>
</div>

Re: [s2smedia] Listing column spacing

Hi S2media,

Does the space appear in the last group regardless of which the last group is or does it stick with the "entertainment" section?

The only thing that comes to mind (purely a guess) is that you might try calling your maxCol variables maxCol1, maxCol2, etc. and see if that makes a difference.



Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php