0
私はこのループを使って記事からイメージを抽出して画像ギャラリーに入れます。だから私は したいです。イメージを含まない場合は、var $イメージを超えて、無視してください。つまり、$ 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; ?>
Dudeは、そのコードをフォーマットします。目が痛い。 –