随机主题

燃烧的冰2021-11-02  141

板块和详情页板块随机主题,当前板块和详情页所属板块内的随机主题。仅限板块(不包含频道)和详情页,默认 bootstrap· 样式,自行修改。

<?php $arrlist = thread_tid_find_by_fid($fid, 1, 1000, FALSE);
if ($arrlist) {
    $total = $forum['threads'] > 20 ? 20 : $forum['threads'];
    $tidarr = $forum['threads'] > 20 ? array_rand($arrlist, $total) : array_keys($arrlist);
    $arrlist = well_thread_find_asc($tidarr, $total);
}
?>
<?php if($arrlist){ ?>
<div class="shadow mt-3">
    <div class="card-header bg-light">
        <h3 class="h6 font-weight-bold my-0">
            随机推荐
        </h3>
    </div>
    <ul class="list-group list-group-flush">
        <!-- 循环输出主题 开始 -->
        <?php foreach($arrlist as $_thread) { ?>
        <li class="list-group-item bg-white">
            <h4 class="h6 my-0">
                <!-- 主题链接 -->
                <a href="<?php echo $_thread['url'];?>" class="d-block text-truncate" <?php echo (10==$_thread['type']?'rel="nofollow" target="_blank"':''); ?> title='<?php echo $_thread['subject'];?>' aria-label='<?php echo $_thread['subject'];?>'>
                    <!-- 主题 -->
                    <?php echo $_thread['subject'];?>
                </a>
            </h4>
        </li>
        <?php } ?>
        <!-- 循环输出主题 结束 -->
    </ul>
</div>
<?php } ?>
0
最新回复(0)