在foreach轮播中使用C#foreach,在每个项目中显示4个项目

时间:2013-12-09 09:19:21

标签: php jquery

我有以下网站, http://bamboobeez.com/

我怎样才能显示5张图片而不是3张?

我似乎无法获得以下代码吗?

<div id="slider-fixed-products" class="carousel slide">
    <div class="carousel-inner">

        <div class="active item">
            <ul class="thumbnails">    
            <?$i=0;
            foreach ($ads as $ad):?>
            <?if ($i%3==0 AND $i!=3):?></ul></div><div class="item"><ul class="thumbnails"><?endif?>
            <li class="span3">
                <div class="thumbnail">
                    <a href="<?=Route::url('ad', array('category'=>$ad->category->seoname,'seotitle'=>$ad->seotitle))?>">
                  <?if($ad->get_first_image()!== NULL):?>
                        <img src="<?=URL::base('http')?><?=$ad->get_first_image()?>" >
                    <?else:?>
                        <img src="http://www.placehold.it/200x200&text=<?=$ad->category->name?>"> 
                    <?endif?>
                    </a>
                  <div class="caption">
                    <h5><a href="<?=Route::url('ad', array('category'=>$ad->category->seoname,'seotitle'=>$ad->seotitle))?>"><?=$ad->title?></a></h5>
                    <p><?=substr(Text::removebbcode($ad->description), 0, 30)?></p>

                  </div>
                </div>
            </li>
            <?$i++;
            endforeach?>
        </ul>
      </div>
    </div>
    <a class="left carousel-control" href="#slider-fixed-products" data-slide="prev">&lsaquo;</a>
    <a class="right carousel-control" href="#slider-fixed-products" data-slide="next">&rsaquo;</a>
  </div>

1 个答案:

答案 0 :(得分:0)

<?if ($i%5==0 AND $i!=5):?></ul></div><div class="item"><ul class="thumbnails">

如果条件使用5而不是3