联系官方销售客服

1835022288

028-61286886

迅睿框架 版主:迅睿框架研发组
评论调用与缩略图调用语法
类型:迅睿CMS 更新时间:2024-10-28 23:21:10 module=MOD_DIR CodeIgniter

有缩略图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}


回帖
  • 外聘专员-优速IT设计
    #1楼    外聘专员-优速IT设计
    2024-10-28 23:16:01
    Chrome 0
    <?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}


  • 马拉糕
    #2楼    马拉糕
    2024-10-28 23:21:10
    Chrome 0
    外聘专员-优速IT设计 组合到一起, 一个图片一个评论, 循环三次。