评论调用与缩略图调用语法 迅睿框架 更新 2024-10-28 23:21:10 马拉糕 有缩略图10张和10条评论如何随机调取3张缩略图和3条评论组成一个内容。将下面的代码重组<?php if ($thumb) { $key=0;foreach ($thumb as $c) { ?><img src="{dr_get_file($c.file)}" ><?php $key++;} } ?>{comment module=MOD_DIR order=rand() num=3}<p>{$t.content}</p>{/comment}
<?php if ($thumb) { $key=0;foreach ($thumb as $c) { if($key>3) { break; } ?> <img src="{dr_get_file($c.file)}" > <?php $key++;} } ?> {comment module=MOD_DIR order=rand num=3} <p>{$t.content}</p> {/comment}