使用平台:Dx2.5、IIS7.5
知识点:
1、首页、文章列表页的用户链接伪静态化。
例如:(http://www.discuz.net/home.php?mod=space&uid=859)转换为(http://www.discuz.net/uid-859.html)
2、可解决:伪静态开启,用户名是中文的,查看用户空间提示【抱歉,您指定的用户空间不存在】(http://www.discuz.net/thread-2621478-1-1.html)
3、官方后台提供的伪静态规则已经过时,这里仅提供适用于该主题的伪静态规则。IIS7.5(web.config)使用。

1、 ../source/function/function_forum.php //函数库
修改:末尾添加- //自定义函数
- function GetLastPosterId($UserName)//最后回复UID
- {
- $sql = DB::query("SELECT uid FROM " . DB::table('common_member') . " WHERE username = '$UserName'");
- $row = DB::fetch($sql);
- return $row['uid'];
- }
复制代码 保留末尾:?>
2、 ../source/function/function_forumlist.php //论坛首页
修改前:- $lastpost['author'] = '<a href="home.php?mod=space&username='.rawurlencode($lastpost['author']).'">'.$lastpost['author'].'</a>';
复制代码 修改后:- $lastpost['author'] = '<a href="home.php?mod=space&uid='.GetLastPosterId($lastpost['author']).'" target="_blank">'.$lastpost['author'].'</a>';
复制代码 3、 ../template/default/forum/forumdisplay_list.htm //列表页
修改前:- <a href="{if $thread[digest] != -2}home.php?mod=space&username=$thread[lastposterenc]{else}forum.php?mod=viewthread&tid=$thread[tid]&page={echo max(1, $thread[pages]);}{/if}" c="1">$thread[lastposter]</a>
复制代码 修改后:- <a href="{if $thread[digest] != -2}home.php?mod=space&uid={echo GetLastPosterId($thread[lastposter]);}{else}forum.php?mod=viewthread&tid=$thread[tid]&page={echo max(1, $thread[pages]);}{/if}" c="1">$thread[lastposter]</a>
复制代码 PS:需要对应的伪静态规则,否则会报错。
以上内容Dx2.0和Dx2.5是一致的,下边提供伪静态规则:
注意:该规则为Web.config文件,其他环境请自行对照修改。
|
上一篇: 教你在Discuz!X3.1关闭帖子列表的快速发帖,并保留帖子的快速回复功能下一篇: 想搬家,不会,不知道怎好?
|