使用过Discuz的帖内分页功能的用户都会发现,点击翻页按钮时页面是保持在原位切换的,如果两个页面的内容行数相差过多,会很影响用户的阅读体验,另外如果使用了目录功能,那么下方的翻页按钮将会隐藏,这种设计真的很无语,给出一个修改方案:
修改 ./source/module/forum/forum_viewthread.php 查找
if($_GET['cp'] != 'all' && strpos($post['message'], '[/index]') === FALSE && empty($_GET['threadindex']) && !$messageindex) {
$_G['forum_posthtml']['footer'][$post['pid']] .= '<div id="threadpage"></div><script type="text/javascript" reload="1">show_threadpage('.$post['pid'].', '.$cp.', '.count($messagearray).', '.($_GET['from'] == 'preview' ? '1' : '0').');</script>';
修改为
if($_GET['cp'] != 'all' && strpos($post['message'], '[/index]') === FALSE && empty($_GET['threadindex']) ) {
$_G['forum_posthtml']['footer'][$post['pid']] .= '<div id="threadpage"></div><script type="text/javascript" reload="1">show_threadpage('.$post['pid'].', '.$cp.', '.count($messagearray).', '.($_GET['from'] == 'preview' ? '1' : '0').');window.scrollTo("0","0");</script>';
目前官方版本的翻页存在BUG,如果第一页含有代码文字,则第一页的翻页按钮会消失,已经提交,坐等官方修复