改进了一下相关资讯这个地方,如果没有添加的话,则默认读取:当前分类下、阅读量超过10 小于20 的10条热门资讯
不用修改discuzx模板程序文件
文件路径:sourcemoduleportalportal_view.php
查找:
$article['related'] = array();
$query = DB::query("SELECT a.aid,a.title
FROM ".DB::table('portal_article_related')." r
LEFT JOIN ".DB::table('portal_article_title')." a ON a.aid=r.raid
WHERE r.aid='$aid' ORDER BY r.displayorder");
while ($value = DB::fetch($query)) {
$article['related'][] = $value;
}
替换成:
$article['related'] = array();
if (empty($article['related'])){
$query = DB::query("SELECT a.aid,a.title
FROM ".DB::table('portal_article_related')." r
LEFT JOIN ".DB::table('portal_article_title')." a ON a.aid=r.raid
WHERE r.aid='$aid' ORDER BY r.displayorder");
}
else{
$query = DB::query("SELECT * FROM ".DB::table('portal_article_title')." a LEFT JOIN ".DB::table('portal_article_count')." b ON a.aid=b.aid WHERE a.catid=$article[catid] AND a.aid!=$aid AND b.viewnum>1 AND b.viewnum<20 ORDER BY b.viewnum ASC ,b.dateline DESC LIMIT 0,10");
}
while ($value = DB::fetch($query)) {
$article['related'][] = $value;
}
这是一个例子,大家自己改改数字就行了
未经允许不得转载:445IT之家 » Discuzx 门户模块相关资讯读取当前分类热门