无法解决如何每 4 次获得最后一个迭代行,但我需要找到最后一个,这样我才能让它做一些事情
foreach( $gallery->getMedia() as $key => $media )
{
if( ($key % 4 ) == 0 ) $html .= '<div class="clear"></div>';
$url = $media->dir . '/' . $media->filename;
$html .= sprintf( '<li><a href="#photo-%s" class="album_image_wrapper" id="photo_%s" title="%s" alt="%s" target="_blank" class="image-link" rel="slideshow"><div style="background-image: url(\'',
$media->id ,
$media->id ,
$url,
$gallery->name ,
$media->id ,
$this->generateThumbUrl( $url, array( 'width' => 100, 'height'=> 120, 'zoom' => true) ),
$media->title,
$galleryID );