让主页显示指定板块的“板块置顶帖子”
Tillreetree 2022-5-14

在你当前启用的主题里的hook文件夹创建一个文件,文件名为“index_threadlist_before.htm”,内容任选其一:

[ttPay]<?php 
/* 指定板块帖子 + 置顶帖子 + 普通帖子 */
if($page === 1) {
    $threadlist = thread_find_by_fids(array(1), 1, $pagesize, $order, $threads) + $threadlist; //把array(1)中的1换成要显示的板块ID(可在后台看到)
    thread_list_access_filter($threadlist, $gid); //过滤帖子列表,必须要做
}
?>
<?php 
/* 置顶帖子 + 指定板块帖子 + 普通帖子 */
if($page === 1) {
    $threadlist = $toplist3 + thread_find_by_fids(array(1), 1, $pagesize, $order, $threads) + thread_find_by_fids($fids, $page, $pagesize, $order, $threads); //把array(1)中的1换成要显示的板块ID(可在后台看到)
    thread_list_access_filter($threadlist, $gid); //过滤没有权限访问的帖子,必须要做
}
?>
<?php 
/* 指定板块置顶帖子 + 全站置顶帖子 + 普通帖子 */
if($page === 1) {
    $threadlist = thread_top_find(1) + $threadlist;
    thread_list_access_filter($threadlist, $gid); //过滤没有权限访问的帖子,必须要做
}
?>
<?php 
/* 全站置顶帖子 + 指定板块置顶帖子 + 普通帖子 */
if($page === 1) {
    $threadlist = $toplist3 + thread_top_find(1) + thread_find_by_fids($fids, $page, $pagesize, $order, $threads); //把1换成要显示的板块ID(可在后台看到)
    thread_list_access_filter($threadlist, $gid); //过滤没有权限访问的帖子,必须要做
}
?>

<?php
/* 所有板块置顶帖子 + 全站置顶帖子 + 普通帖子 */
if ($page === 1) {
    $threadlist_alltop = array();
    foreach (arrlist_values($forumlist, 'fid') as $key => $value) {
        $r = thread_top_find( $value );
        $threadlist_alltop = array_merge($threadlist_alltop , $r );
    }
    $threadlist = $threadlist_alltop + $threadlist;
    thread_list_access_filter($threadlist, $gid);
}
?>

<?php
/* 全站置顶帖子 + 所有板块置顶帖子 + 普通帖子 */
if ($page === 1) {
    $threadlist_alltop = array();
    foreach (arrlist_values($forumlist, 'fid') as $key => $value) {
        $r = thread_top_find( $value );
        $threadlist_alltop = array_merge($threadlist_alltop , $r );
    }
    $threadlist = $toplist3 + $threadlist_alltop + thread_find_by_fids($fids, $page, $pagesize, $order, $threads);
    thread_list_access_filter($threadlist, $gid);
}
?>
[/ttPay]

以上。

最后于 2022-5-15 被Tillreetree编辑 ,原因:
最新回复 (8)
全部楼主
  • 22sscn
    2022-5-14 2
    0
    楼主,你写得实在是太好了。我惟一能做的,就只有把这个帖子顶上去这件事了。 
  • JIIoPN
    2022-7-25 3
    0
    哈哈,不错哦!
  • zhang050512
    2022-10-29 4
    0
    楼主,你写得实在是太好了。我惟一能做的,就只有把这个帖子顶上去这件事了。 
  • sos001
    2023-3-31 5
    0
    楼主,你写得实在是太好了。我惟一能做的,就只有把这个帖子顶上去这件事了。 
  • 小泽天下
    11月前 6
    0
    楼主,我只是来混个熟的!老板,侬亿雷凑闹嫩了!
  • sioooooolly
    10月前 7
    0
    顶顶顶顶顶顶顶!!!
  • xiaonanwl
    5月前 8
    0
    你就是我心中的那首忐忑,总是让我惊心动魄。 
  • weige
    1月前 9
    0
    楼主,你写得实在是太好了。我惟一能做的,就只有把这个帖子顶上去这件事了。 
返回