Я использую этот цикл для извлечения изображений из статей, чтобы поместить его в галерею изображений ... так что я хочу выйти за пределы или игнорировать var $ image, если не содержит image .. Другими словами, мне не нужно печатать $ image или оставлятьпустое место в галерее .. спасибо за помощь
<?php
$count = 0;
// loop through and display format
foreach($articles as $article):
// stripes the table by adding a class to every other row
$class = ( ($count % 2) ? " class='altrow'": '' );
$regex = '/src="(.*?)"/';
preg_match_all($regex, $article['Article']['content'], $matches);
$matches = $matches[1];
foreach($matches as &$match)
$match = substr($match, strrpos($match, '/') + 1);
$image =(implode($matches ));
?>
<li> <?php
if(isset($image) && $image != ""){
e( $html->link( $html->image(image ,array('height'=>'75px', 'width'=>'75px')),array('action' => 'view', $article['Article']['id']),array('escape' => false)));
}else{
/// What is supposed to put here ///
}
?></li>
<?php endforeach; ?>