Add thumbnail with each title displayed
5 posts by 2 authors in: Forums > CMS Builder
Last Post: February 24, 2010 (RSS)
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.
invisionshosting.com
Re: [invisions] Add thumbnail with each title displayed
By gkornbluth - February 24, 2010 - edited: February 24, 2010
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"> </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
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
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.
invisionshosting.com
Re: [invisions] Add thumbnail with each title displayed
By gkornbluth - February 24, 2010 - edited: February 24, 2010
For each record, you'd upload a unique list page image for that record.
Then the thumbnail that displays next to a particular "title" is the one you uploaded.
Best,
Jerry
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
Thanks again!!!!
invisionshosting.com