Laying out tables to force data

4 posts by 3 authors in: Forums > CMS Builder
Last Post: January 23, 2009   (RSS)

By misery217 - January 22, 2009

I did this once upon a time in days of yore and probably with Article Manager, but as a N00b to CMS Builder, here is the question:

Say I want to have a photo gallery in a table with 3 columns across and I want the data to go across and up and down. I've put the code in the first cell of one table with 3 columns, however all this accomplishes is to have it post to the far left with the next image below it (Of which I want to appear to its right and so on). I've probably forgotten, but what is the magic trick to accomplish this? I indeed did search through the forum to no avail.

Thank for all the help!

Aaron

Re: [Dave] Laying out tables to force data

By gkornbluth - January 23, 2009

While we’re on the subject, I’ve got another question about columns.

All of the posts that I could find deal with rows of single cells repeating after a number of columns.

I'm trying to get a set of 2 rows to repeat after 2 columns and for some reason I can’t seem to find the magic. (I know that I’m going to feel really dumb when I see what’s wrong)

Thanks,

Jerry Kornbluth

Here’s the single cell solution that works: http://www.marshazart.com/glassart3.php

<table width="100%" border="0" cellpadding="10">
<tr>
<?php foreach ($glass_artRecords as $record): ?><?php foreach ($record['image'] as $upload): ?>
<td align="center" valign="middle" width="50%"><img src="<?php echo $upload['thumbUrlPath2'] ?>" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" alt="" />
<div class="medium-title"><?php echo $record['title'] ?></div>
<div class="medium-text"><?php echo $record['sub_title'] ?></div>
</td>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>
<?php endforeach ?><?php endforeach ?>
</tr>
</table>

Here’s what I’ve tried for the 2 row solution that doesn’t work (the sets of rows don’t appear under each other): http://www.marshazart.com/glassart4.php

<table width="100%" border="0" cellpadding="10">
<tr>
<?php foreach ($glass_artRecords as $record): ?><?php foreach ($record['image'] as $upload): ?> <td align="center" valign="middle" width="50%"><img src="<?php echo $upload['thumbUrlPath2'] ?>" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" alt="" />
</td><tr></tr><td>
<div class="medium-title"><?php echo $record['title'] ?></div>
<div class="medium-text"><?php echo $record['sub_title'] ?></div>
</td>
<?php $maxCols=2; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>
<?php endforeach ?><?php endforeach ?>
</tr>
</table>
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

Re: [Dave] Laying out tables to force data

By misery217 - January 23, 2009

Wow, okay, the table code was EXACTLY what I was needing!!! Thanks so much Dave!! No on to more questions!