Thumbnail limit max ''6''

HATEM

New Member
I'm using Drupal 7 and create a module for my content thumbnail images frontpage display. Working this:\[code\] if(count($p_detail->field_slide) > 0){ $output .= '<div class="right">'; $output .= '<ul class="thumbs">'; $i=6; foreach($p_detail->field_slide['und'] as $thumb): $img_path = $thumb['uri']; $img_url = image_style_url('tmb_240x117', $img_path); $img_file = '<img src="'.$img_url.'" alt="'.$p_detail->title.'" />'; $output .= '<li> <a href="'.$p_url.'"> '.$img_file.' <div class="shadow"></div> <div class="hoverimg"></div> </a> <div class="img_no">0'.$i.'</div> </li>'; $i--; endforeach; $output .= '</ul>'; $output .= '</div>'; }\[/code\]My thumbnails, field_slide and i want only first 6 thumbnails (if have 6 images... for exam, have 2 images, display 2 thumbnails)How can i do this?
 
Back
Top