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

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

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

By Perchpole - November 11, 2008

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

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