Discuz!门户文章相关阅读随机排序修改方法 [复制链接]

moqu8 2020-9-4

11 0

找到文件:source\module\portal\portal_view.php
找到如下代码

  1. $article['related'] = array();
  2. if(($relateds = C::t('portal_article_related')->fetch_all_by_aid($aid))) {
  3.     foreach(C::t('portal_article_title')->fetch_all(array_keys($relateds)) as $raid => $value) {
  4.         $value['uri'] = fetch_article_url($value);
  5.         $article['related'][$raid] = $value;
  6.     }
  7. }


修改成

  1. $article['related'] = array();
  2. if(($relateds = C::t('portal_article_related')->fetch_all_by_aid($aid))) {
  3.     foreach(C::t('portal_article_title')->fetch_all(array_keys($relateds)) as $raid => $value) {
  4.         $value['uri'] = fetch_article_url($value);
  5.         $article['related'][$raid] = $value;
  6.     }
  7.     shuffle($article['related']);
  8. }

最新回复 (0)
返回
支持中心
邮箱:winkill2012@qqcom
新站优化中!部分功能尚未完善,敬请谅解!
支持中心