Everybody busy there? 2-Column code needed ASAP, please.

5 posts by 3 authors in: Forums > CMS Builder
Last Post: November 11, 2008   (RSS)

By matrix - November 11, 2008

I'm hoping this is easy for you experts and am sorry if this seems like a double post. I just need this right away, and since it's a common request, thought you might be able to answer quickly.

Here's the 2-column code that doesn't work. (It did in previous versions with different tags.) This is for thumbnails in rows of two within a right-hand column on the page:



<?php foreach ($cottagesRecords as $record): ?>

<!-- THUMBNAILS BEGIN -->
<table border="0" cellpadding="8" cellspacing="0" width="100%"><tr>
<?php foreach ($record['image_for_thumbnail'] as $upload): ?>


<?php if ($upload['hasThumbnail']): ?>

<td align="center" valign="top">
<table class="BGrey" cellpadding="8" cellspacing="0" width="100%"><tr>
<td align="center" valign="top">

<a href="<?php echo $record['_link'] ?>">
<?php echo $upload['info1'] ?><br/>
<img border="0" src="<?php echo $upload['thumbUrlPath'] ?>"
width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>" /></a>
</td></tr></table>

<?php $maxCols=2; if (@++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif ?>
<?php endif ?>
<?php endforeach ?>

</tr></table>
<!-- THUMBNAILS END -->




<?php if (!$cottagesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->

<?php endforeach ?>


I will be eternally grateful for the solution to this. Are the 2-columns still doable in latest version of CMS Builder?

Thank you SO much!
Happy Interactive Tools product user since 1999

Re: [matrix] Everybody busy there? 2-Column code needed ASAP, please.

By Dave - November 11, 2008

Hi Matrix,

Are you getting any output at all? Try viewing source to see what is going on and these changes. Also, make sure you have thumbnails for your uploads:

<!-- THUMBNAILS BEGIN -->
<table border="0" cellpadding="8" cellspacing="0" width="100%"><tr>

<?php foreach ($record['image_for_thumbnail'] as $upload): ?>

<?php if ($upload['hasThumbnail']): ?>

<td align="center" valign="top">

<table class="BGrey" cellpadding="8" cellspacing="0" width="100%"><tr>
<td align="center" valign="top">
<a href="<?php echo $record['_link'] ?>">
<?php echo $upload['info1'] ?><br/>
<img border="0" src="<?php echo $upload['thumbUrlPath'] ?>"
width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>" /></a>
</td></tr></table>

</td>

<?php $maxCols=2; if (@++$count % $maxCols == 0): ?>
</tr><tr>
<?php endif ?>

<?php endif ?>

<?php endforeach ?>

</tr></table>
<!-- THUMBNAILS END -->


Note where I added the missing <td> tag. If that still doesn't work feel free to email me some urls and FTP and CMS login details to dave@interactivetools.com (email, don't post login details to forum).
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Everybody busy there? 2-Column code needed ASAP, please.

By matrix - November 11, 2008

Just sent you the login info...can't thank you enough for this!

I've said it before, but it surely bears repeating...you have the best support in the business.
Happy Interactive Tools product user since 1999

Re: [Perchpole] Everybody busy there? 2-Column code needed ASAP, please.

By matrix - November 11, 2008

Good point. I was trying to shorten the code...taking out anything extraneous for that template...but you are right about the argument.

This is a template where that first "if" argument will always be satisfied since the image (and corresponding thumbnail) is a required upload.

Is there a better way to write that? (I'm sure there is...I'm woefully inadequate in PHP but can usually muddle through by trial and error. Very cool language.)

Thanks for the tip.
Happy Interactive Tools product user since 1999