Discuz!x2.5 实现主题分类伪静态的方法教程

[复制链接]
查看3382 | 回复1 | 2019-2-10 14:16 | 显示全部楼层 |阅读模式
Discuz!x2.5 实现主题分类伪静态的方法教程
  1. RewriteRule ^(.*)/zidiu-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&filter=typeid&typeid=$3&$5
复制代码

代码中 zidiu  这个可以根据自己的爱好来设置(后面需要使用到,请记住你的设置)。
   
       下一步,如何把伪静态的地址写在文件中。
       我们打开这个文件 /source/module/forum/forum_forumdisplay.php
       查找以下代码:

  1. if($_G['forum']['threadtypes']['prefix'] == 1) {
  2. $thread['typehtml'] = '<em>[<a href="forum.php?mod=forumdisplay&fid='.$_G['fid'].'&filter=typeid&typeid='.$thread['typeid'].'">'.$_G['forum']['threadtypes']['types'][$thread['typeid']].'</a>]</em>';
复制代码


修改为:

  1. if($_G['forum']['threadtypes']['prefix'] == 1) {
  2. $thread['typehtml'] = '<em>【<a href="rizhi-'.$_G['fid'].'-'.$thread['typeid'].'.html">'.$_G['forum']['threadtypes']['types'][$thread['typeid']].'</a>】</em>';
复制代码


代码中【】是主题分类的括号,可以删除原来的是[ ] 看着太小气了。
       通过如上的修改就可以实现主题列表页的主题分类伪静态。
  
       因为是昨天的弄的。好像这样弄了主题还是动态的。我们在修改以下文件。
       /template/default/forum/forumdisplay_list.htm

  1. $thread[typehtml] $thread[sorthtml]
  2. <!--{if $thread['moved']}-->
  3. {lang thread_moved}:<!--{eval $thread[tid]=$thread[closed];}-->
  4. <!--{/if}-->
  5. <a href="forum.php?mod=viewthread&tid=$thread[tid]&{if $_GET['archiveid']}archiveid={$_GET['archiveid']}&{/if}extra=$extra"$thread[highlight]{if $thread['isgroup'] == 1 || $thread['forumstick']} target="_blank"{else}{/if} class="xst" >$thread[subject]</a>
复制代码


修改为:
  1. $thread[typehtml] $thread[sorthtml]
  2. <!--{if $thread['moved']}-->
  3. {lang thread_moved}:<!--{eval $thread[tid]=$thread[closed];}-->
  4. <!--{/if}-->
  5. <a href="thread-{$thread[icontid]}-{$_G}-1.html" target="_blank" class="xst" >$thread[subject]</a>
复制代码





自丢网 | 2019-8-20 05:06 | 显示全部楼层
学习了,感谢自丢教程网
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

UID
1
贡献
387
丢币
38902
主题
4607
回帖
116
注册时间
2018-9-25
最后登录
2024-4-16