Photos to appear in differnet colums

13 posts by 2 authors in: Forums > CMS Builder
Last Post: September 17, 2008   (RSS)

By kitka - September 14, 2008

I want to develop a simple gallery for my customer so they can display photos in a 3 colum by whatever rows deep.
If i just copy the present setup as shown below it simply put repeats the items after every row...

Can anyone help with this...Much appreciated?

Here is a smaple mockup...

http://www.rocaroalpacas.ca/saturday.php

So each column and row has a different photo and text....

The preesent text for each <td> <./td> is as follows:

<td><h6> Click for larger view </h6> <br> <?php foreach ($record['mainphoto'] as $upload): ?> <a href="<?php echo $upload['urlPath'] ?>"target="_blank"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" border="0" /></a><br><br> <?php endforeach ?> </td>
jim albert

Re: [kitka] Photos to appear in differnet colums

By Dave - September 15, 2008

Hi Kitka,

Try this:

<table border="1" cellspacing="0" cellpadding="0"><tr>

<?php foreach ($record['mainphoto'] as $upload): ?>
<td>
<a href="<?php echo $upload['urlPath'] ?>"
target="_blank"><img src="<?php echo $upload['thumbUrlPath'] ?>"
width="<?php echo $upload['thumbWidth'] ?>"
height="<?php echo $upload['thumbHeight'] ?>" alt="" border="0" /></a><br><br>
</td>

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

<?php endforeach ?>
</tr></table>


That will create a table with a cell for each record. Then ever 3 records (cells) it will start a new row.

Hope that helps! Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Photos to appear in differnet colums

By kitka - September 15, 2008



Hi Dave...

No it doesn't work...

http://www.rocaroalpacas.ca/males11.php
jim albert

Re: [kitka] Photos to appear in differnet colums

By Dave - September 15, 2008

I had just copied your earlier code. Is there an upload field called 'mainphoto' in the section you are displaying?

That error usually means there is no matching field found.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Photos to appear in differnet colums

By kitka - September 15, 2008

Yes....

I just took the info from the working version om

http://www.rocaroalpacas.ca/males10.php

Here was the code for that section

<br><?php foreach ($malesRecords as $record): ?>
<table bgcolor="#e4deb1" width="693" cellspacing="0" cellpadding="1" border="0">
<tr>
<td colspan="2" bgcolor="#E6A634"height="15"valign="center"> <h5><?php echo $record['name'] ?></h5> </td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="240" valign="top"> &nbsp; </td>
<td width="240" valign="top"> &nbsp; </td>
<td rowspan="2" align="center" valign="top"> <h6> Click for larger view </h6> <br> <?php foreach ($record['mainphoto'] as $upload): ?> <a href="<?php echo $upload['urlPath'] ?>"target="_blank"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" border="0" /></a><br><br> <?php endforeach ?> </td>
</tr>
<tr>
<td colspan="2" width="480" valign="top"><h6><strong>A little info about... <?php echo $record['name'] ?></strong></h6> <br><br>
<h6> <?php echo $record['content'] ?></h6><br/></td><?php endforeach ?>
</tr>
</table>
<br><br>
<div align="center"> ---------------------</div><br><br>
jim albert

Re: [kitka] Photos to appear in differnet colums

By Dave - September 16, 2008

Hi kitka,

Can you attach the file males11.php to the post?

Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Photos to appear in differnet colums

By kitka - September 16, 2008

Ok here it is....
jim albert

Re: [kitka] Photos to appear in differnet colums

By Dave - September 16, 2008

Make sure you click the "Upload Attachment" button.
Dave Edis - Senior Developer
interactivetools.com

Re: [kitka] Photos to appear in differnet colums

By kitka - September 16, 2008

Try again...
jim albert
Attachments:

males11.php 7K