【发布时间】:2013-02-27 11:08:10
【问题描述】:
我正在尝试使用 php 和 jquery mobile 构建动态网格。我想知道是否有人可以帮助我使用模数来确定 ui-block- 是否需要 a-d 取决于迭代的键值。
<div class="ui-grid-c">
@forelse($photos as $key=>$photo)
@if($key == 1)
<div class="ui-block-a">
<img src="{{ $photo['file'] }}" width="60" />
</div>
@elseif($key == 2)
<div class="ui-block-b">
<img src="{{ $photo['file'] }}" width="60" />
</div>
@elseif($key == 3)
<div class="ui-block-c">
<img src="{{ $photo['file'] }}" width="60" />
</div>
@elseif($key == 4)
<div class="ui-block-d">
<img src="{{ $photo['file'] }}" width="60" />
</div>
@endif
@empty
Nothing Found
@endforelse
</div>
我尝试了几种不同的模数变化,但都没有奏效。任何帮助将不胜感激。
【问题讨论】: