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.

Hi, Matrix -

I certainly don't class myself as an expert - but I have used CMSB to build several gallery pages - as it seems you are trying to do. The most obvious problem with your code (to my eyes) is that your "if" arguments have no corresponding "else" clauses....

[font "Verdana"] [font "Verdana"]<?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>
[font "Verdana"]<?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 ?>



Your code should run fine if every "if" argument is "true". However, if the argument is "false" your code will run into a brick wall - simply because you have not told it what to do next!

I suggest you add the "else" clasues and try the code again...

:0)

Perch

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