Multi column?

5 posts by 2 authors in: Forums > CMS Builder
Last Post: December 4, 2009   (RSS)

Re: [jimbly2] Multi column?

By jimbly2 - December 4, 2009

I have trawled through some of the other posts regarding this - but I don't really understand where the php and mysql queries fit into the table?

cheers

Jim

Re: [jimbly2] Multi column?

By jimbly2 - December 4, 2009

I found some code

<table width="657" cellpadding="3" cellspacing="5"> <tr> <?php foreach ($clubsRecords as $record): ?> <?php $maxCols=3; if (@++$count % $maxCols == 0): ?> </tr><tr> <?php endif ?> <td valign="top"> <?php echo $record['county'] ?><br/>
<span class="bodytext"><?php echo $record['area'] ?><br/>
<?php echo $record['title'] ?><br/>
<a href="<?php echo $record['_link'] ?>&quot;&gt;<?php echo $record['_link'] ?>">Click for more info:</a></span> <br/>
<hr/>
<span class="bodytext">
</td>
<?php endforeach ?> </tr> </table>

Which almost does what I want - but the left hand column has 6 items, the middle one 5 and the end one 4? How can I even it up?

thanks

Jim

Re: [jimbly2] Multi column?

I think your counter is misplaced ... try this.

<table width="657" cellpadding="3" cellspacing="5">
<tr>
<?php foreach ($clubsRecords as $record): ?>
<td valign="top">
<?php echo $record['county'] ?><br/>
<span class="bodytext"><?php echo $record['area'] ?><br/>
<?php echo $record['title'] ?><br/>
<a href="<?php echo $record['_link'] ?>&quot;&gt;<?php echo $record['_link'] ?>">Click for more info:</a></span> <br/>
<hr/>
</td>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?> </tr><tr> <?php endif ?>
<?php endforeach ?>
</tr>
</table>
Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

Re: [rconring] Multi column?

By jimbly2 - December 4, 2009

Perfect! Thanks so much :-)



best,

Jim [sly]