Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
How to show only first image only on albumList.php?

 

 


jacgo
User

Dec 14, 2011, 12:04 AM

Post #1 of 4 (310 views)
Shortcut
How to show only first image only on albumList.php? Can't Post

Hi, dear all

My album list page is albumList.php

How to show only first image on the album List page?
http://www.rscf.org.tw/site/albumList.php

code below:

<table border="0" cellpadding="0" cellspacing="0" width="228" id="table1">
<tr>
<?php foreach ($albumRecords as $record): ?>
<td style="border-style: solid; border-width: 1px" bordercolor="#D4D5D6"><table border="0" cellpadding="0" cellspacing="5" width="100%" id="table2">
<tr>
<td width="7%">&nbsp;</td>
<td width="88%"><p class="homeProductName"><?php echo $record['title'] ?></p></td>
<td width="5%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td height="70" valign="top"><p class="body"><a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a></p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td height="70" valign="top"><?php foreach ($record['photos'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
<?php endif ?>
<?php endforeach ?></td>
<td>&nbsp;</td>
</tr>
</table></td>
<?php $maxCols=3; if (@++$count % $maxCols == 0): ?>
</tr>
<tr>
<?php endif; ?>
<?php endforeach ?>
</tr>
</table>



Thanks!

Jacgo


Jason
Staff / Moderator


Dec 14, 2011, 12:09 AM

Post #2 of 4 (309 views)
Shortcut
Re: [jacgo] How to show only first image only on albumList.php? [In reply to] Can't Post

Hi Jacgo,

You can use a break right after your output a thumbnail like this:


Code
<td height="70" valign="top"> 
<?php foreach ($record['photos'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
<?php break; ?>
<?php endif ?>
<?php endforeach ?>
</td>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/ 


jacgo
User

Dec 14, 2011, 12:44 AM

Post #3 of 4 (306 views)
Shortcut
Re: [Jason] How to show only first image only on albumList.php? [In reply to] Can't Post

Hi Jason

It's looks great!

other issue:

How can I post my code on forum like yours? (code formating)
Your code looks clear.
it's help everyone to look it.

Thanks for your help.



Jacgo


robin
User / Moderator


Dec 14, 2011, 9:10 AM

Post #4 of 4 (296 views)
Shortcut
Re: [jacgo] How to show only first image only on albumList.php? [In reply to] Can't Post

Hey Jacgo,

There are buttons under the reply text box that you can use to add tags to your post. If you use the code tags, everything between the open code tag and close code tag will be nicely formatted.

A list of all the tags you can use is here:
http://www.interactivetools.com/forum/gforum.cgi?do=markup_help;

Hope that helps,
Robin