友声网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
开启左侧

Discuz! X3 主题分类伪静态化方法

[复制链接]
admin 发表于 2018-7-6 22:05 | 显示全部楼层 |阅读模式
修改方法:
1,在/source/function/function_admincp.php查找
  1. if(in_array('forum_forumdisplay', $_G['setting']['rewritestatus'])) {
  2.                         $data['search']['forum_forumdisplay'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=forumdisplay&(amp;)?fid\=(\w+)(&page\=(\d+))?"([^\>]*)\>/e";
  3.                         $data['replace']['forum_forumdisplay'] = "rewriteoutput('forum_forumdisplay', 0, '\\1', '\\3', '\\5', '\\6')";
  4.                 }
复制代码

在下面添加如下:
  1.                 if(in_array('forum_forumdisplay_type', $_G['setting']['rewritestatus'])) {
  2.                         $data['search']['forum_forumdisplay_type'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=forumdisplay&(amp;)?fid\=(\w+)(&typeid\=(\w+))?(&filter\=typeid)?(&typeid\=(\w+))?(&filter\=typeid)?(&page\=(\d+))?"([^\>]*)\>/e";
  3.                         $data['replace']['forum_forumdisplay_type'] = "rewriteoutput('forum_forumdisplay_type', 0, '\\1', '\\3', '\\8', '\\11', '\\12')";
  4.                 }
复制代码

查找:
  1.                 $data['rulesearch']['forum_forumdisplay'] = 'forum-{fid}-{page}.html';
  2.                 $data['rulereplace']['forum_forumdisplay'] = 'forum.php?mod=forumdisplay&fid={fid}&page={page}';
  3.                 $data['rulevars']['forum_forumdisplay']['{fid}'] = '(\w+)';
  4.                 $data['rulevars']['forum_forumdisplay']['{page}'] = '([0-9]+)';
复制代码

在下面添加如下:
  1.                 $data['rulesearch']['forum_forumdisplay_type'] = 'forum-{fid}-{typeid}-{page}.html';
  2.                 $data['rulereplace']['forum_forumdisplay_type'] = 'forum.php?mod=forumdisplay&fid={fid}&filter=typeid&typeid={typeid}&page={page}';
  3.                 $data['rulevars']['forum_forumdisplay_type']['{fid}'] = '(\w+)';
  4.                 $data['rulevars']['forum_forumdisplay_type']['{typeid}'] = '(\w+)';
  5.                 $data['rulevars']['forum_forumdisplay_type']['{page}'] = '([0-9]+)';
复制代码


2、在/source/function/function_core.php查找
  1. if($type == 'forum_forumdisplay') {
  2. list(,,, $fid, $page, $extra) = func_get_args();
  3. $r = array(
  4. '{fid}' => empty($_G['setting']['forumkeys'][$fid]) ? $fid : $_G['setting']['forumkeys'][$fid],
  5. '{page}' => $page ? $page : 1,
  6. );
  7. }
复制代码


在下面添加如下:
  1.         if($type == 'forum_forumdisplay') {
  2.                 list(,,, $fid, $page, $extra) = func_get_args();
  3.                 $r = array(
  4.                         '{fid}' => empty($_G['setting']['forumkeys'][$fid]) ? $fid : $_G['setting']['forumkeys'][$fid],
  5.                         '{page}' => $page ? $page : 1,
  6.                 );
  7.         } elseif($type == 'forum_forumdisplay_type') {
  8.                 list(,,, $fid, $typeid, $page, $extra) = func_get_args();
  9.                 $r = array(
  10.                         '{fid}' => empty($_G['setting']['forumkeys'][$fid]) ? $fid : $_G['setting']['forumkeys'][$fid],
  11.                         '{typeid}' => $typeid,
  12.                         '{page}' => $page ? $page : 1,
  13.                 );
  14.         }
复制代码


3、在/source/language/lang_admincp.php里查找
  1. 'setting_seo_rewritestatus_forum_forumdisplay' => '论坛主题列表页',
复制代码

在这行下面添加如下:
  1. 'setting_seo_rewritestatus_forum_forumdisplay_type' => '论坛主题分类页',
复制代码


下面是主题贴子静态化方法:
1,在/source/function/function_admincp.php查找
  1. <span style="line-height: 1.5;">if(in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {</span>
  2.                         $data['search']['forum_viewthread'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=viewthread&(amp;)?tid\=(\d+)(&extra\=(page\%3D(\d+))?(%26filter%3Dtypeid%26typeid%3D(\d+))?)?(&page\=(\d+))?"([^\>]*)\>/e";
  3.                         $data['replace']['forum_viewthread'] = "rewriteoutput('forum_viewthread', 0, '\\1', '\\3', '\\10', '\\6', '\\11')";
  4.                 }
复制代码

修改为:
  1. <span style="line-height: 1.5;">if(in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {</span>
  2.                         $data['search']['forum_viewthread'] = "/".$_G['domain']['pregxprw']['forum']."\?mod\=viewthread&(amp;)?tid\=(\d+)(&extra\=(page\%3D(\d+))?(%26filter%3Dtypeid%26typeid%3D(\d+))?)?(&page\=(\d+))?"([^\>]*)\>/e";
  3.                         $data['replace']['forum_viewthread'] = "rewriteoutput('forum_viewthread', 0, '\\1', '\\3', '\\10', '\\6', '\\11')";
  4.                 }
复制代码

演示:http://www.ys166.com/sort-2-2-1.html

RSS|无图版|手机版|友声网 ( 鲁ICP备15020090号-1 )|网站地图 | | 点击这里给我发消息 |

GMT+8, 2024-12-23 08:24 , Processed in 0.013909 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X

© ys166.com

快速回复 返回顶部 返回列表