Forcing columns in multi row tables

7 posts by 2 authors in: Forums > CMS Builder
Last Post: January 28, 2009   (RSS)

Re: [gkornbluth] Forcing columns in multi row tables

By Dave - January 27, 2009

Hi Jerry,

Can you create a quick mockup url so I can see what it's suppose to look like? Once I can see that I should have a better idea.

Thanks! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Forcing columns in multi row tables

By gkornbluth - January 27, 2009

Thanks Dave,

Here's the html mockup.

http://www.marshazart.com/glassart5.php

it's essentially the same as the glassart4.php cms version mentioned above

I wanted to use sets of 2 rows so that the alignment of the images and the alignment of the titles and other text were independent and lined up evenly regardless of the image heights.

Jerry
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: [gkornbluth] Forcing columns in multi row tables

By Dave - January 27, 2009

Hi Jerry,

Thanks for that. Those can be tricky. We could write some PHP code to do it, but it might be a bit complicated. Another way to do it is to use a table inside a table (or CSS, divs etc) so you can display the image and text in one tablecell (using a table inside that cell to align in).

How many records do you want to show on the page? With complex layouts another way is to refer to each record by number and lay them all out manually rather than looping over them. You can do that like this: $records[0]['title'], $records[1]['title'], etc. And test if a record is defined like this:

<?php if (@$records[0]): ?>
... show record 0 (which is actually record 1, but programmers sometimes count from zero)...
<?php endif ?>

Let me know if either of those would work for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Forcing columns in multi row tables

By gkornbluth - January 27, 2009

Thanks for taking the time to respond Dave,

The table within a table approach sounds feasible. since I'd like not to limit the number of images.

Not sure how you would approach it though. How would it alter the PHP code above?

Thanks

Jerry
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: [gkornbluth] Forcing columns in multi row tables

By Dave - January 28, 2009

Hi Jerry,

Maybe something like this:

<td align="center" valign="middle" width="50%">

<table border="1" cellspacing="0" cellpadding="0">
<tr><td>
<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></tr>
</tr></table>

</td>


And you'd probably want a fixed height on the td with the thumbnail so they all line up the same.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Forcing columns in multi row tables

By gkornbluth - January 28, 2009

It worked perfectly.

Thanks

Jerry
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