DedeCMS 5.7系统TAG标签伪静态设置_dedecms_CMS教程_脚本之家

1.修改前台显示链接sjF迪尔课堂自学网-|第二课堂|--(官网)

我们这里达到的效果就是使原来/tags.php?keywors更改为/tags/keywords.html。sjF迪尔课堂自学网-|第二课堂|--(官网)

这里主要修改下调用的标签,在include/tag/libtag.lib.php中,在87行找到sjF迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
$row['link'] = $cfg_cmsurl."/tags?".urlencode($row['keyword']);
sjF迪尔课堂自学网-|第二课堂|--(官网)
将其改为:sjF迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html";
sjF迪尔课堂自学网-|第二课堂|--(官网)

2.修改分页代码sjF迪尔课堂自学网-|第二课堂|--(官网)

我们需要修改include/arc.taglist.class.php,将分页函数替换为:sjF迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
sjF迪尔课堂自学网-|第二课堂|--(官网)
/** * 获取动态的分页列表sjF迪尔课堂自学网-|第二课堂|--(官网)
*sjF迪尔课堂自学网-|第二课堂|--(官网)
* @access publicsjF迪尔课堂自学网-|第二课堂|--(官网)
* @param int $list_len 列表宽度sjF迪尔课堂自学网-|第二课堂|--(官网)
* @param string $listitem 列表样式sjF迪尔课堂自学网-|第二课堂|--(官网)
* @return stringsjF迪尔课堂自学网-|第二课堂|--(官网)
*/sjF迪尔课堂自学网-|第二课堂|--(官网)
function GetPageListDM($list_len,$listitem="info,index,end,pre,next,pageno")sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$prepage="";sjF迪尔课堂自学网-|第二课堂|--(官网)
$nextpage="";sjF迪尔课堂自学网-|第二课堂|--(官网)
$prepagenum = $this->PageNo - 1;sjF迪尔课堂自学网-|第二课堂|--(官网)
$nextpagenum = $this->PageNo + 1;sjF迪尔课堂自学网-|第二课堂|--(官网)
if($list_len == "" || preg_match("/[^0-9]/", $list_len))sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$list_len = 3;sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
$totalpage = $this->TotalPage;sjF迪尔课堂自学网-|第二课堂|--(官网)
if($totalpage <= 1 && $this->TotalResult > 0)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
return "<span class="pageinfo">共1页/".$this->TotalResult."条</span>";sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
if($this->TotalResult == 0)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
return "<span class="pageinfo">共0页/".$this->TotalResult."条</span>";sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
$maininfo = "<span class="pageinfo">共{$totalpage}页/".$this->TotalResult."条</span>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
$purl = $this->GetCurUrl();sjF迪尔课堂自学网-|第二课堂|--(官网)
$basename = basename($purl);sjF迪尔课堂自学网-|第二课堂|--(官网)
$tmpname = explode('.', $basename);sjF迪尔课堂自学网-|第二课堂|--(官网)
sjF迪尔课堂自学网-|第二课堂|--(官网)
$purl = str_replace($basename, '', $purl).urlencode($this->Tag);sjF迪尔课堂自学网-|第二课堂|--(官网)
//var_dump($purl);exit;sjF迪尔课堂自学网-|第二课堂|--(官网)
//$purl .= "?/".urlencode($this->Tag);sjF迪尔课堂自学网-|第二课堂|--(官网)
sjF迪尔课堂自学网-|第二课堂|--(官网)
//获得上一页和下一页的链接sjF迪尔课堂自学网-|第二课堂|--(官网)
if($this->PageNo != 1)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$prepage.="<li><a href='".$purl."-$prepagenum'.html>上一页</a></li>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
$indexpage="<li><a href='".$purl."-1.html'>首页</a></li>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
elsesjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$indexpage="<li><a>首页</a></li>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
if($this->PageNo!=$totalpage && $totalpage>1)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$nextpage.="<li><a href='".$purl."-$nextpagenum.html'>下一页</a></li>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
$endpage="<li><a href='".$purl."-$totalpage.html'>末页</a></li>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
elsesjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$endpage="<li><a>末页</a></li>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
sjF迪尔课堂自学网-|第二课堂|--(官网)
//获得数字链接sjF迪尔课堂自学网-|第二课堂|--(官网)
$listdd="";sjF迪尔课堂自学网-|第二课堂|--(官网)
$total_list = $list_len * 2 + 1;sjF迪尔课堂自学网-|第二课堂|--(官网)
if($this->PageNo >= $total_list)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$j = $this->PageNo - $list_len;sjF迪尔课堂自学网-|第二课堂|--(官网)
$total_list = $this->PageNo + $list_len;sjF迪尔课堂自学网-|第二课堂|--(官网)
if($total_list > $totalpage)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$total_list = $totalpage;sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
elsesjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$j=1;sjF迪尔课堂自学网-|第二课堂|--(官网)
if($total_list > $totalpage)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$total_list = $totalpage;sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
for($j; $j<=$total_list; $j++)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
if($j == $this->PageNo)sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$listdd.= "<li class="thisclass"><a>$j</a></li>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
elsesjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$listdd.="<li><a href='".$purl."-$j.html'>".$j."</a></li>rn";sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
$plist = '';sjF迪尔课堂自学网-|第二课堂|--(官网)
if(preg_match('/info/i', $listitem))sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$plist .= $maininfo.' ';sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
if(preg_match('/index/i', $listitem))sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$plist .= $indexpage.' ';sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
if(preg_match('/pre/i', $listitem))sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$plist .= $prepage.' ';sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
if(preg_match('/pageno/i', $listitem))sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$plist .= $listdd.' ';sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
if(preg_match('/next/i', $listitem))sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$plist .= $nextpage.' ';sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
if(preg_match('/end/i', $listitem))sjF迪尔课堂自学网-|第二课堂|--(官网)
{sjF迪尔课堂自学网-|第二课堂|--(官网)
$plist .= $endpage.' ';sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
return $plist;sjF迪尔课堂自学网-|第二课堂|--(官网)
}sjF迪尔课堂自学网-|第二课堂|--(官网)
sjF迪尔课堂自学网-|第二课堂|--(官网)

3.设置伪静态规则sjF迪尔课堂自学网-|第二课堂|--(官网)

我们这里以iis7为例子,设置以下规则:sjF迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
sjF迪尔课堂自学网-|第二课堂|--(官网)
<?xml version="1.0" encoding="UTF-8"?>sjF迪尔课堂自学网-|第二课堂|--(官网)
<configuration>sjF迪尔课堂自学网-|第二课堂|--(官网)
<system.webServer>sjF迪尔课堂自学网-|第二课堂|--(官网)
<rewrite>sjF迪尔课堂自学网-|第二课堂|--(官网)
<rules>sjF迪尔课堂自学网-|第二课堂|--(官网)
<rule name="weather1" stopProcessing="true">sjF迪尔课堂自学网-|第二课堂|--(官网)
<match url="tags/([^-]+).html$" ignoreCase="true" />sjF迪尔课堂自学网-|第二课堂|--(官网)
<conditions logicalGrouping="MatchAll">sjF迪尔课堂自学网-|第二课堂|--(官网)
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />sjF迪尔课堂自学网-|第二课堂|--(官网)
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />sjF迪尔课堂自学网-|第二课堂|--(官网)
</conditions>sjF迪尔课堂自学网-|第二课堂|--(官网)
<action type="Rewrite" url="/tags.php?/{R:1}" appendQueryString="false" />sjF迪尔课堂自学网-|第二课堂|--(官网)
</rule>sjF迪尔课堂自学网-|第二课堂|--(官网)
<rule name="weather2" stopProcessing="true">sjF迪尔课堂自学网-|第二课堂|--(官网)
<match url="tags/([^-]+)-([0-9]+).html$" ignoreCase="true" />sjF迪尔课堂自学网-|第二课堂|--(官网)
<conditions logicalGrouping="MatchAll">sjF迪尔课堂自学网-|第二课堂|--(官网)
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />sjF迪尔课堂自学网-|第二课堂|--(官网)
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />sjF迪尔课堂自学网-|第二课堂|--(官网)
</conditions>sjF迪尔课堂自学网-|第二课堂|--(官网)
<action type="Rewrite" url="/tags.php?/{R:1}/{R:2}" appendQueryString="false" />sjF迪尔课堂自学网-|第二课堂|--(官网)
</rule>sjF迪尔课堂自学网-|第二课堂|--(官网)
</rules>sjF迪尔课堂自学网-|第二课堂|--(官网)
</rewrite>sjF迪尔课堂自学网-|第二课堂|--(官网)
</system.webServer>sjF迪尔课堂自学网-|第二课堂|--(官网)
</configuration>sjF迪尔课堂自学网-|第二课堂|--(官网)
sjF迪尔课堂自学网-|第二课堂|--(官网)
 sjF迪尔课堂自学网-|第二课堂|--(官网)
可以直接保存为web.config放在站点根目录。sjF迪尔课堂自学网-|第二课堂|--(官网)

4.重新生成html页面sjF迪尔课堂自学网-|第二课堂|--(官网)
sjF迪尔课堂自学网-|第二课堂|--(官网)
这个操作就不用说了,全部重新生成下,至此全部修改完毕。sjF迪尔课堂自学网-|第二课堂|--(官网)

5.预览查看显示结果sjF迪尔课堂自学网-|第二课堂|--(官网)
sjF迪尔课堂自学网-|第二课堂|--(官网)
至此,我们已经完成了所有的设置,可以查看:http://www.**.net/tags/PHP.html语言效果。sjF迪尔课堂自学网-|第二课堂|--(官网)

扫一扫手机访问