<?
$sql = dbquery("SELECT `id`, `title`, `description` FROM `content` LIMIT 0,12 ");
while ($row = mysql_fetch_array($sql)) {
$id = $row["id"];
$title = $row["title"];
$description = $row["description"];
$content = '
<div class="description-box">
<p>page id: ' . $id . '</p>
<p>' . $title . '</p>
<p>' . $description . '</p>
</div>';
}
echo $content;
?>
// 注意:div class="description-box"
// 我如何在每 3 个输出 div 之后将其替换为:div class="description-box nopadding"?
html生成代码示例:
<div class="description-box nopadding">
// content
</div>
<div class="description-box">
// content
</div>
<div class="description-box">
// content
</div>
<div class="description-box">
// content
</div>
// 然后再次使用 divnopadding