来源:未知
浏览 151次
时间 2021-06-21 16:04
现在许多CMS系统都具有TAGS标签的功能。众所周知的DEDECMS也有它但它的标签功能很差不利于seo优化。与此同时云客网不利于seo优化。与此同时也存在许多问题。例如当前页面上不存在当前页面时链接为“ - 问题1”以及“系统没有此标签可能已被删除”的问题。
今天我教你将标签伪静态(一些信息来自网络)并修复一些上面提到的错误。
1.修改前景显示链接
我们在这里实现的效果是将原始的/tags.php?keywors更改为/tags/keywords.html。
这里主要修改名为/include/taglib/tag.lib.php的标签在第87行找到
$ row ['link']=$ cfg_cmsurl。"/tags?"urlencode($ row ['keyword']);
将其更改为:
$ row ['link']=$ cfg_cmsurl。"/tags /"urlencode($ row ['keyword'])。"html&quot ;
2.修改分页代码部分
我们需要修改include/arc.taglist.class.php来查找分页功能并将其替换为:
/**
*获取动态分页列表
*
* @access public
* @param int $ list_len列表宽度
* @param string $ listitem列表样式
* @return字符串
* /
函数GetPageListDM($ list_len$ listitem=" infoindexendprenextpageno")
{
$ prepage=QUOT;英寸;
$下一页=QUOT;英寸;
$ prepagenum=$ this-> PageNo - 1;
$ nextpagenum=$ this-> PageNo + 1;
如果($ list_len=="" || preg_match("/[^ 0-9] /"$ list_len))
{
$ list_len=3;
}
$ totalpage=$ this-> TotalPage;
如果($ totalpage<=1&& $ this-> TotalResult> 0)
{
返回"< span class=\" pageinfo \">总计1页/"$ this-> TotalResult。" Article</span>&quot ;
}
如果($ this-> TotalResult==0)
{
返回"< span class=\" pageinfo \">共0页/。$。this-> TotalResult。" Article</span>&quot ;
}
$ maininfo="< span class=\" pageinfo \">总计{$ totalpage} Page /"$ this-> TotalResult。" Article</span> \ r \ n&quot ;
$ purl=$ this-> GetCurUrl();
$ basename=basename($ purl);
$ tmpname=explode('。'$ basename);
$ purl=str_replace($ basename''$ purl).urlencode($ this-> Tag);
//后续代码var_dump($金银丝);退出;
//$ purl。="/"urlencode($ this-> Tag);
//获取上一页和下一页之间的链接
//if($ this-> PageNo!=1)这是一个将前一页更正为负的问题
如果($ this-> PageNo!=1&& $ this-> PageNo!="")
{
$ prepage。="< li>< a href='"$ purl。" - $ prepagenum'.html> Previous</a></li> \ r \ n&quot ;
$ indexpage="< li>< a href='"$ purl。" -1.html'> Home</a></li> \ r \ n&quot ;
}
其他
{
$ indexpage=QUOT;<李>&LT a取代;家庭和LT;/A>< /立GT; \ r \ n英寸;
}
如果($ this-> PageNo!=$ totalpage&& $ totalpage> 1)
{
$ nextpage。="< li>< a href='"$ purl。" - $ nextpagenum.html'> Next Page</a></li> \ r \ n"
$ endpage="< li>< a href='"$ purl。" - $ totalpage.html'>最后一页</a></li> \ r \ n&quot ;
}
其他
{
$ endpage="< li>< a>最后一页</a></li> \ r \ n&quot ;
}
//获取数字链接
$ listdd=QUOT;英寸;
$ total_list=$ list_len * 2 + 1;
如果($ this-> PageNo>=$ total_list)
{
$ j=$ this-> PageNo - $ list_len;
$ total_list=$ this-> PageNo + $ list_len;
如果($ total_list> $ totalpage)
{
$ total_list=$ totalpage;
}
}
其他
{
$ J=1;
如果($ total_list> $ totalpage)
{
$ total_list=$ totalpage;
}
}
对于($ j; $ j<=$ total_list; $ j ++)
{
如果($ j==$ this-> PageNo)
{
$ listdd。="< li class=\" thisclass \">< a> $ j</a></li> \ r \ n&quot ;
}
其他
{
$ listdd。="< li>< a href='"$ purl。" - $ j.html'>"$ j。"</a></li> \ r \ n英寸;
}
}
$ plist='';
如果(preg_match('/info/i'$ listitem))
{
$ plist。=$ maininfo。' “;
}
如果(preg_match('/index/i'$ listitem))
{
$ plist。=$ indexpage。' “;
}
如果(preg_match('/pre/i'$ listitem))
{
$ plist。=$ prepage。' “;
}
如果(preg_match('/pageno/i'$ listitem))
{
$ plist。=$ listdd。' “;
}
如果(preg_match('/next/i'$ listitem))
{
$ plist。=$ nextpage。' “;
}
如果(preg_match('/end/i'$ listitem))
{
$ plist。=$ endpage。' “;
}
返回$ plist;
}
3.设置伪静态规则
这里我们使用iis7作为示例来设置以下规则:
复制到ClipboardLiehuo.Net代码引用内容:[www.veryhuo.com]
<xml version=" 1.0"编码=QUOT; UTF-8英寸;>
<结构>
< system.webServer>
<重写>
<规则>
< rule name=" weather1" stopProcessing=QUOT;真">
< match url=" tags /([^ - ] +)\。html $" IGNORECASE=QUOT;真" />
< conditions logicalGrouping=" MatchAll">
< add input=" {REQUEST_FILENAME}"使用MatchType=QUOT; ISFILE"否定=QUOT;真" />
< add input=" {REQUEST_FILENAME}"使用MatchType=QUOT; IsDirectory"否定=QUOT;真" />
< /条件>
< action type="重写" url=" /tags.php?/{R: 1}" appendQueryString=QUOT假QUOT; />
< /规则>
< rule name=" weather2" stopProcessing=QUOT;真">
< match url=" tags /([^ - ] +) - ([0-9] +)\。html $" IGNORECASE=QUOT;真" />
< conditions logicalGrouping=" MatchAll">
< add input=" {REQUEST_FILENAME}"使用MatchType=QUOT; ISFILE"否定=QUOT;真" />
< add input=" {REQUEST_FILENAME}"使用MatchType=QUOT; IsDirectory"否定=QUOT;真" />
< /条件>
< action type="重写" url=" /tags.php?/{R: 1}/{R: 2}" appendQueryString=QUOT假QUOT; />
< /规则>
< /规则>
< /重写>
< /system.webServer>
< /结构>
好的我已经完成了。 标签:
cmsTAG静态织梦标签系统设置分页