DedeCMS系统TAG标签伪静态设置
<p><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>1.修改前台显示链接 </strong><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>我们这里达到的效果就是使原来/tags.php?keywors更改为/tags/keywords.html。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这里主要修改下调用的标签,在includetaglibtag.lib.php中,在87行找到 </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
$row['link'] = $cfg_cmsurl."/tags?".urlencode($row['keyword']); </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>将其改为: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html"; </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>2.修改分页代码</strong><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'> </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>我们需要修改include/arc.taglist.class.php,将分页函数替换为: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
/** * 获取动态的分页列表 <br>
* <br>
* @access public <br>
* @param int $list_len 列表宽度 <br>
* @param string $listitem 列表样式 <br>
* @return string <br>
*/ <br>
function GetPageListDM($list_len,$listitem="info,index,end,pre,next,pageno") <br>
{ <br>
$prepage=""; <br>
$nextpage=""; <br>
$prepagenum = $this->PageNo - 1; <br>
$nextpagenum = $this->PageNo + 1; <br>
if($list_len == "" || preg_match("/[^0-9]/", $list_len)) <br>
{ <br>
$list_len = 3; <br>
} <br>
$totalpage = $this->TotalPage; <br>
if($totalpage <= 1 && $this->TotalResult > 0) <br>
{ <br>
return "<span class="pageinfo">共1页/".$this->TotalResult."条</span>"; <br>
} <br>
if($this->TotalResult == 0) <br>
{ <br>
return "<span class="pageinfo">共0页/".$this->TotalResult."条</span>"; <br>
} <br>
$maininfo = "<span class="pageinfo">共{$totalpage}页/".$this->TotalResult."条</span>rn"; <br>
$purl = $this->GetCurUrl(); <br>
$basename = basename($purl); <br>
$tmpname = explode('.', $basename); <br>
$purl = str_replace($basename, '', $purl).urlencode($this->Tag); <br>
//var_dump($purl);exit; <br>
//$purl .= "?/".urlencode($this->Tag); <br>
//获得上一页和下一页的链接 <br>
if($this->PageNo != 1) <br>
{ <br>
$prepage.="<li><a href='".$purl."-$prepagenum'.html>上一页</a></li>rn"; <br>
$indexpage="<li><a href='".$purl."-1.html'>首页</a></li>rn"; <br>
} <br>
else <br>
{ <br>
$indexpage="<li><a>首页</a></li>rn"; <br>
} <br>
if($this->PageNo!=$totalpage && $totalpage>1) <br>
{ <br>
$nextpage.="<li><a href='".$purl."-$nextpagenum.html'>下一页</a></li>rn"; <br>
$endpage="<li><a href='".$purl."-$totalpage.html'>末页</a></li>rn"; <br>
} <br>
else <br>
{ <br>
$endpage="<li><a>末页</a></li>rn"; <br>
} <br>
//获得数字链接 <br>
$listdd=""; <br>
$total_list = $list_len * 2 + 1; <br>
if($this->PageNo >= $total_list) <br>
{ <br>
$j = $this->PageNo - $list_len; <br>
$total_list = $this->PageNo + $list_len; <br>
if($total_list > $totalpage) <br>
{ <br>
$total_list = $totalpage; <br>
} <br>
} <br>
else <br>
{ <br>
$j=1; <br>
if($total_list > $totalpage) <br>
{ <br>
$total_list = $totalpage; <br>
} <br>
} <br>
for($j; $j<=$total_list; $j++) <br>
{ <br>
if($j == $this->PageNo) <br>
{ <br>
$listdd.= "<li class="thisclass"><a>$j</a></li>rn"; <br>
} <br>
else <br>
{ <br>
$listdd.="<li><a href='".$purl."-$j.html'>".$j."</a></li>rn"; <br>
} <br>
} <br>
$plist = ''; <br>
if(preg_match('/info/i', $listitem)) <br>
{ <br>
$plist .= $maininfo.' '; <br>
} <br>
if(preg_match('/index/i', $listitem)) <br>
{ <br>
$plist .= $indexpage.' '; <br>
} <br>
if(preg_match('/pre/i', $listitem)) <br>
{ <br>
$plist .= $prepage.' '; <br>
} <br>
if(preg_match('/pageno/i', $listitem)) <br>
{ <br>
$plist .= $listdd.' '; <br>
} <br>
if(preg_match('/next/i', $listitem)) <br>
{ <br>
$plist .= $nextpage.' '; <br>
} <br>
if(preg_match('/end/i', $listitem)) <br>
{ <br>
$plist .= $endpage.' '; <br>
} <br>
return $plist; <br>
} </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>3.设置伪静态规则 </strong><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>我们这里以iis7为例子,设置以下规则: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
<?xml version="1.0" encoding="UTF-8"?> <br>
<configuration> <br>
<system.webServer> <br>
<rewrite> <br>
<rules> <br>
<rule name="weather1" stopProcessing="true"> <br>
<match url="tags/([^-]+).html$" ignoreCase="true" /> <br>
<conditions logicalGrouping="MatchAll"> <br>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <br>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <br>
</conditions> <br>
<action type="Rewrite" url="/tags.php?/{R:1}" appendQueryString="false" /> <br>
</rule> <br>
<rule name="weather2" stopProcessing="true"> <br>
<match url="tags/([^-]+)-(+).html$" ignoreCase="true" /> <br>
<conditions logicalGrouping="MatchAll"> <br>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <br>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <br>
</conditions> <br>
<action type="Rewrite" url="/tags.php?/{R:1}/{R:2}" appendQueryString="false" /> <br>
</rule> <br>
</rules> <br>
</rewrite> <br>
</system.webServer> <br>
</configuration> </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>可以直接保存为web.config放在站点根目录。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>4.重新生成html页面</strong><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'> </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>这个操作就不用说了,全部重新生成下,至此全部修改完毕。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>5.预览查看显示结果</strong><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'> </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>至此,我们已经完成了所有的设置</span></p>
頁:
[1]