Add thumbnail with each title displayed

5 posts by 2 authors in: Forums > CMS Builder
Last Post: February 24, 2010   (RSS)

By invisions - February 24, 2010

Hello.
I need to add a unique thumbnail picture with each title listed on my page. Here is a reference of what I am trying to do: http://www.cloughharbour.com/go/project

And, I am currently using the following code to list the titles:


<div id="fp_list_placement">
<?php foreach ($environmental_analysisRecords as $record): ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a>
<br/>
<hr/>
<?php endforeach ?>
</div>


I appreciate the help.

Thanks.
Daniel Pegues
invisionshosting.com

Re: [invisions] Add thumbnail with each title displayed

By gkornbluth - February 24, 2010 - edited: February 24, 2010

Hi Daniel,

Unless I'm missing something (altogether possible), you should be able to display (thumbnail) images by adding this to your code after the link and before the <hr><?php foreach ($record['your_image_upload_field'] as $upload): ?>

<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php endforeach ?>


If your question is about formatting, here's an excerpt from my CMSB Cookbook www.thecmsbcookbook.com that sets up a 2 column table with a linked image.

<table width="90%" border="0" cellpadding="5"><?php foreach ($environmental_analysisRecords as $record): ?>
<tr>
<td align="center">&nbsp;</td>
<td align="left" valign="top"><hr align="left" width="300" color="#99945e"/></td>
</tr>
<tr>
<td align="center">

<?php foreach ($record['your_image_upload_field'] as $upload): ?><a href="<?php echo $record['_link'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /></a>
<?php endforeach; ?>

</td><td align="left" valign="top"><a href="<?php echo $record['_link'] ?>"><span class="heading-text-bold"><?php echo $record['title'] ?></span>
</a><?php endforeach; ?> </td>
</tr>
</table>


Don't forget to change the your_image_upload_field and the styling to your values.

Hope that helps,

Jerry Kornbluth
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] Add thumbnail with each title displayed

By invisions - February 24, 2010

Hey Jerry,
Thank you very much for your post and your help.

With the code you provided, how do I choose which thumbnail image to use for each title listed? Do I do this in the admin panel, and if so, where in the admin panel do I choose a thumbnail image for each article/title?

Thank you again.
Daniel Pegues
invisionshosting.com

Re: [gkornbluth] Add thumbnail with each title displayed

By invisions - February 24, 2010

Thank you so much again for your help Jerry. It is late where I am right now, so I am gonna get to this first thing in the morning. I will write tomorrow and let you know how it goes.

Thanks again!!!!
Daniel Pegues
invisionshosting.com