配列をループしようとしていますが、3ループごとに新しい行が作成されますが、それを機能させるのに問題があります。現在、私のコードは次のようになっています。
<li class="row">
<?php for ($i = 0; $i < count($results); $i++) : ?>
<div class="grid_8">
<div class="candidate <?php if ($i % 3 == 2) echo "end"; ?>">
<div class="model_image shadow_50"></div>
<dl>
<dt><?php echo $results[$i]['first_name']; ?> <?php echo $results[$i]['surname']; ?></dt>
<dd>
<?php echo $results[$i]['talent']; ?>
<ul>
<li><?php echo anchor("/candidates/card/" . strtolower($results[$i]['first_name']) . "-" . strtolower($results[$i]['surname']), "View Details", array('class' => 'details')); ?></li>
<li><?php echo anchor("/candidates/card/" . strtolower($results[$i]['first_name']) . "-" . strtolower($results[$i]['surname']), "View Showreel", array('class' => 'showreel')); ?></li>
<li><?php echo anchor("/candidates/card/" . strtolower($results[$i]['first_name']) . "-" . strtolower($results[$i]['surname']), "Shortlist", array('class' => 'shortlist')); ?></li>
</ul>
</dd>
</dl>
</div>
</div>
<?php if ($i % 3 == 3) : ?>
</li><li class="row">
<?php endif; ?>
<?php endfor; ?>
ただし、これは1つの行を作成し、その中にすべての結果が含まれますが、行のクラスを含む1 li、次に3つの.grid_8 div、次に別の行を作成する必要があります。
どこが間違っているのですか?