Discuz后台的伪静态配置不包含门户频道页的伪静态配置。应该是考虑到频道页的URL地址变化太多的原因。下面,我们就来开发源码,加上这个功能。
第一步:加上语言包中的记录:
根目录下:sourcelanguagelang_admincp.php ,找到setting_seo_rewritestatus_portal_article 这一行,大概在1500行左右,搜索一下吧。
在这句下面加上一句:'setting_seo_rewritestatus_portal_list' => '门户频道页',
第二步:在后台加上设置项
根目录下:sourcefunctionfunction_admincp.php ,找到rewritedata函数,在if语句的,两个大括号中,加上下面两段程序
上面一段加上
if (in_array('portal_list', $_G['setting']['rewritestatus']"" {
$data['search']['portal_list'] = "/" . $_G['domain']['pregxprw']['portal'] . "?mod=list&(amp;"?catid=(d+"(&page=(d+""?"([^>]*">/e";
$data['replace']['portal_list'] = "rewriteoutput('portal_list', 0, '1', '3', '5', '6'"";
}
下面一段加上
$data['rulesearch']['portal_list'] = 'list-{catid}-{page}.html';
$data['rulereplace']['portal_list'] = 'portal.php?mod=list&catid={catid}&page={page}';
$data['rulevars']['portal_list']['{catid}'] = '([0-9]+"';
$data['rulevars']['portal_list']['{page}'] = '([0-9]+"';
第三步:兼容栏目页URL地址设置
找到文件:
根目录sourcefunctionfunction_portal.php 下的函数getportalcategoryurl
重新写成下面的代码:
function getportalcategoryurl($catid" {
if (empty($catid""
return '';
loadcache('portalcategory'";
$portalcategory = getglobal('cache/portalcategory'";
if ($portalcategory[$catid]" {
$url = str_replace('&', '&', $portalcategory[$catid]['caturl']";
$url = str_replace('&', '&', $url";
$url = str_replace('http://'.$_SERVER['HTTP_HOST'].'/', '', $url";
return $url;
} else {
return '';
}
}
第四步:设置前台页面URL地址切换
根目录00phpsourcefunctionfunction_core.php 这个文件中找到:函数rewriteoutput
在一串的if ... else if中加上一段
elseif ($type == 'portal_list'" {
list(,,, $id, $page, $extra" = func_get_args(";
$r = array(
'{catid}' => $id,
'{page}' => $page ? $page : 1,
";
}
至此,大功告成。



