官方给的根据tag调用相关主体,怎么排除当前的主题和随机显示呀

woshisiyu2022-11-12  624

<?php if ($thread['tag']) {
    $tagids = array_keys($thread['tag_fmt']);
    $arrlist = well_tag_thread_find($tagids, 1, 100);
    !$arrlist and $arrlist = well_tag_thread__find(array(), array('id' => 1), 1, 100);

    if ($arrlist) {
        $count = count($arrlist);
        $total = $count > $pagesize ? $pagesize : $count;
        $tidarr = $count > 20 ? array_rand($arrlist, $total) : array_keys($arrlist);

        $arrlist = well_thread_find_asc($tidarr, $total);
    }
}
?>
<!-- 判断是否有相关主题 开始 -->
<?php if (!empty($arrlist)) { ?>
<div class="card border-0 shadow-sm mb-3">
	<div class="card-header bg-white">
		<h3 class="h6 font-weight-400 my-0">
			猜你喜欢
		</h3>
	</div>
	<ul class="list-group list-group-flush">
		<!-- 循环输出相关主题 开始 -->
		<?php foreach($arrlist as $val) { ?>
		<li class="list-group-item bg-white">
			<h4 class="h6 my-0">
				<a href="<?php echo $val['url'];?>" class="d-block text-truncate">
					<?php echo $val['subject'];?>
				</a>
			</h4>
		</li>
		<?php } ?>
		<!-- 循环输出相关主题 结束 -->
	</ul>
</div>
<?php } ?>
<!-- 判断是否有相关主题 结束 -->

这是官方给的代码

这个怎么排除当前主体呀?并且随机显示

转载请注明原文地址:https://www.wellcms.net/read-436.html
00
最新回复(1)