dedecms tag标签调用电影标签怎么设置

推荐这篇日记的豆列
······您好,欢迎来到织梦帮助中心!
二次开发 DedeCMS系统TAG标签伪静态设置
支持版本:
  来源: 作者:CIT小乐乐  编辑:admin
DedeCMS的系统TAGS确实是一个非常好的功能,通过关键词链接可以快速寻找到相关内容,不过很多人希望能够将TAGS静态化这样更加利于SEO,也是对此进行了优化和调整,只不过cit小虫觉得这种更新内容比较频繁的列表最好采用伪静态的方式,这里就分享下技巧。
1.修改前台显示链接
我们这里达到的效果就是使原来/tags.php?keywors更改为/tags/keywords.html。
这里主要修改下调用的标签,在includetaglibtag.lib.php中,在87行找到
$row['link'] = $cfg_cmsurl.&/tags?&.urlencode($row['keyword']);
将其改为:
$row['link'] = $cfg_cmsurl.&/tags/&.urlencode($row['keyword']).&.html&;
2.修改分页代码
我们需要修改include/arc.taglist.class.php,将分页函数替换为:
& & &* &获取动态的分页列表
& & &* @access & &public
& & &* @param & & int &$list_len &列表宽度
& & &* @param & & string &$listitem &列表样式
& & &* @return & &string
& & function GetPageListDM($list_len,$listitem=&info,index,end,pre,next,pageno&)
& & & & $prepage=&&;
& & & & $nextpage=&&;
& & & & $prepagenum = $this-&PageNo - 1;
& & & & $nextpagenum = $this-&PageNo + 1;
& & & & if($list_len == && || preg_match(&/[^0-9]/&, $list_len))
& & & & & & $list_len = 3;
& & & & $totalpage = $this-&TotalP
& & & & if($totalpage &= 1 && $this-&TotalResult & 0)
& & & & & & return &&span class=&pageinfo&&共1页/&.$this-&TotalResult.&条&/span&&;
& & & & if($this-&TotalResult == 0)
& & & & & & return &&span class=&pageinfo&&共0页/&.$this-&TotalResult.&条&/span&&;
& & & & $maininfo = &&span class=&pageinfo&&共{$totalpage}页/&.$this-&TotalResult.&条&/span&rn&;
& & & & $purl = $this-&GetCurUrl();
& & & & $basename = basename($purl);
& & & & $tmpname = explode('.', $basename);
& & & & $purl = str_replace($basename, '', $purl).urlencode($this-&Tag);
& & & & //var_dump($purl);
& & & & //$purl .= &?/&.urlencode($this-&Tag);
& & & & //获得上一页和下一页的链接
& & & & if($this-&PageNo != 1)
& & & & & & $prepage.=&&li&&a href='&.$purl.&-$prepagenum'.html&上一页&/a&&/li&rn&;
& & & & & & $indexpage=&&li&&a href='&.$purl.&-1.html'&首页&/a&&/li&rn&;
& & & & else
& & & & & & $indexpage=&&li&&a&首页&/a&&/li&rn&;
& & & & if($this-&PageNo!=$totalpage && $totalpage&1)
& & & & & & $nextpage.=&&li&&a href='&.$purl.&-$nextpagenum.html'&下一页&/a&&/li&rn&;
& & & & & & $endpage=&&li&&a href='&.$purl.&-$totalpage.html'&末页&/a&&/li&rn&;
& & & & else
& & & & & & $endpage=&&li&&a&末页&/a&&/li&rn&;
& & & & //获得数字链接
& & & & $listdd=&&;
& & & & $total_list = $list_len * 2 + 1;
& & & & if($this-&PageNo &= $total_list)
& & & & & & $j = $this-&PageNo - $list_
& & & & & & $total_list = $this-&PageNo + $list_
& & & & & & if($total_list & $totalpage)
& & & & & & {
& & & & & & & & $total_list = $
& & & & & & }
& & & & else
& & & & & & $j=1;
& & & & & & if($total_list & $totalpage)
& & & & & & {
& & & & & & & & $total_list = $
& & & & & & }
& & & & for($j; $j&=$total_ $j++)
& & & & & & if($j == $this-&PageNo)
& & & & & & {
& & & & & & & & $listdd.= &&li class=&thisclass&&&a&$j&/a&&/li&rn&;
& & & & & & }
& & & & & & else
& & & & & & {
& & & & & & & & $listdd.=&&li&&a href='&.$purl.&-$j.html'&&.$j.&&/a&&/li&rn&;
& & & & & & }
& & & & $plist &= &'';
& & & & if(preg_match('/info/i', $listitem))
& & & & & & $plist .= $maininfo.' ';
& & & & if(preg_match('/index/i', $listitem))
& & & & & & $plist .= $indexpage.' ';
& & & & if(preg_match('/pre/i', $listitem))
& & & & & & $plist .= $prepage.' ';
& & & & if(preg_match('/pageno/i', $listitem))
& & & & & & $plist .= $listdd.' ';
& & & & if(preg_match('/next/i', $listitem))
& & & & & & $plist .= $nextpage.' ';
& & & & if(preg_match('/end/i', $listitem))
& & & & & & $plist .= $endpage.' ';
& & & & return $
3.设置伪静态规则
我们这里以iis7为例子,设置以下规则:
&&?xml version=&1.0& encoding=&UTF-8&?&
&configuration&
& & &system.webServer&
& & & & &rewrite&
& & & & & & &rules&
& & & & & & & & &rule name=&weather1& stopProcessing=&true&&
& & & & & & & & & & &match url=&tags/([^-]+).html$& ignoreCase=&true& /&
& & & & & & & & & & &conditions logicalGrouping=&MatchAll&&
& & & & & & & & & & & & &add input=&{REQUEST_FILENAME}& matchType=&IsFile& negate=&true& /&
& & & & & & & & & & & & &add input=&{REQUEST_FILENAME}& matchType=&IsDirectory& negate=&true& /&
& & & & & & & & & & &/conditions&
& & & & & & & & & & &action type=&Rewrite& url=&/tags.php?/{R:1}& appendQueryString=&false& /&
& & & & & & & & &/rule&
& & & & & & & & &rule name=&weather2& stopProcessing=&true&&
& & & & & & & & & & &match url=&tags/([^-]+)-([0-9]+).html$& ignoreCase=&true& /&
& & & & & & & & & & &conditions logicalGrouping=&MatchAll&&
& & & & & & & & & & & & &add input=&{REQUEST_FILENAME}& matchType=&IsFile& negate=&true& /&
& & & & & & & & & & & & &add input=&{REQUEST_FILENAME}& matchType=&IsDirectory& negate=&true& /&
& & & & & & & & & & &/conditions&
& & & & & & & & & & &action type=&Rewrite& url=&/tags.php?/{R:1}/{R:2}& appendQueryString=&false& /&
& & & & & & & & &/rule&
& & & & & & &/rules&
& & & & &/rewrite&
& & &/system.webServer&
&/configuration&
可以直接保存为web.config放在站点根目录。
4.重新生成html页面
这个操作就不用说了,全部重新生成下,至此全部修改完毕。
5.预览查看显示结果
至此,我们已经完成了所有的设置,可以查看:语言效果。
× 以上内容是否解决了您的问题呢?
我还有问题,我想继续:
最新发布问题
请输入评论内容,至少八个字
&&有疑问的可以跟贴提问!点评:Dedecms网站地图很好用,但sitemap.htm所调用的标签很有限,下面有个不错的方法可以解决这个问题Dedecms网站地图很好用,但sitemap.htm所调用的标签很有限,分析了一下makehtml_map.php?dopost=site这个文件,发现生成视图用的是dedetag.class.php文件,有点简单。所以不能使用织梦的很多标签,例如:
{dede:arclist titlelen=25 row='25'}
&a href="[field:arcurl/]"&[field:title/]&/a&
{/dede:arclist}
就不能解析出列表。
现在仿照首页的方法,使用arc.partview.class.php,这是一个视图类,可以解析这些标签。
修改makehtml_map.php如下:
require_once(DEDEINC."/dedetag.class.php");
require_once(DEDEINC."/arc.partview.class.php");
$dtp = new DedeTagParse();
$dtp-&LoadTemplet($tmpfile);
$dtp-&SaveTo($cfg_basedir.$murl);
$dtp = new PartView();
$GLOBALS['_arclistEnv'] = 'index';
$dtp-&SetTemplet($tmpfile);
$dtp-&SaveToHtml($cfg_basedir.$murl);
$dtp-&Clear();
//$dtp-&Clear();
$murl = $cfg_cmspath."/data/sitemap.html";
$tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/sitemap.htm";
$murl = $cfg_cmspath."/sitemap.html";//把生成的网站地图放在网站根目录下,data目录一般设置了蜘蛛不抓取
$tmpfile = $cfg_basedir.$cfg_templets_dir."/".$cfg_df_style."/sitemap.htm";//同时把网站地图模板改在默认的模板文件夹下
现在就可以解析dedecms所有的标签了,包括文章列表标签。
更多信息请查看
易贤网手机网站地址:
【】&&&&&【】
由于各方面情况的不断调整与变化,易贤网所提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
云南各地招聘
&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp会员注册
本站不参与评论,(&&点此深度交流 )
自觉遵守:爱国、守法、自律、真实、文明的原则
尊重网上道德,遵守中华人民共和国各项有关法律法规
严禁发表危害国家安全,破坏民族团结、国家宗教政策和社会稳定,含侮辱、诽谤、教唆、淫秽等内容的评论
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
您在本站发表的评论,本站有权保留、转载、引用或者删除
参与本评论即表明您已经阅读并接受上述条款
将该文分享到:您当前位置: >>
>> 浏览文章
DedeCMS 5.7系统TAG标签伪静态设置
1.修改前台显示链接
我们这里达到的效果就是使原来/tags.php?keywors更改为/tags/keywords.html。
这里主要修改下调用的标签,在includetaglibtag.lib.php中,在87行找到
复制代码代码如下:$row['link'] = $cfg_cmsurl."/tags?".urlencode($row['keyword']); 将其改为:
复制代码代码如下:$row['link'] = $cfg_cmsurl."/tags/".urlencode($row['keyword']).".html";
2.修改分页代码
我们需要修改include/arc.taglist.class.php,将分页函数替换为:
复制代码代码如下:/**
获取动态的分页列表
function GetPageListDM($list_len,$listitem="info,index,end,pre,next,pageno")
$prepage="";
$nextpage="";
$prepagenum = $this-&PageNo - 1;
$nextpagenum = $this-&PageNo + 1;
if($list_len == "" || preg_match("/[^0-9]/", $list_len))
$list_len = 3;
$totalpage = $this-&TotalP
if($totalpage &= 1 && $this-&TotalResult & 0)
return "&span class="pageinfo"&共1页/".$this-&TotalResult."条&/span&";
if($this-&TotalResult == 0)
return "&span class="pageinfo"&共0页/".$this-&TotalResult."条&/span&";
$maininfo = "&span class="pageinfo"&共{$totalpage}页/".$this-&TotalResult."条&/span&rn";
$purl = $this-&GetCurUrl();
$basename = basename($purl);
$tmpname = explode('.', $basename);
$purl = str_replace($basename, '', $purl).urlencode($this-&Tag);
//var_dump($purl);
//$purl .= "?/".urlencode($this-&Tag);
//获得上一页和下一页的链接
if($this-&PageNo != 1)
$prepage.="&li&&a href='".$purl."-$prepagenum'.html&上一页&/a&&/li&rn";
$indexpage="&li&&a href='".$purl."-1.html'&首页&/a&&/li&rn";
$indexpage="&li&&a&首页&/a&&/li&rn";
if($this-&PageNo!=$totalpage && $totalpage&1)
$nextpage.="&li&&a href='".$purl."-$nextpagenum.html'&下一页&/a&&/li&rn";
$endpage="&li&&a href='".$purl."-$totalpage.html'&末页&/a&&/li&rn";
$endpage="&li&&a&末页&/a&&/li&rn";
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this-&PageNo &= $total_list)
$j = $this-&PageNo - $list_
$total_list = $this-&PageNo + $list_
if($total_list & $totalpage)
$total_list = $
if($total_list & $totalpage)
$total_list = $
for($j; $j&=$total_ $j++)
if($j == $this-&PageNo)
$listdd.= "&li class="thisclass"&&a&$j&/a&&/li&rn";
$listdd.="&li&&a href='".$purl."-$j.html'&".$j."&/a&&/li&rn";
if(preg_match('/info/i', $listitem))
$plist .= $maininfo.' ';
if(preg_match('/index/i', $listitem))
$plist .= $indexpage.' ';
if(preg_match('/pre/i', $listitem))
$plist .= $prepage.' ';
if(preg_match('/pageno/i', $listitem))
$plist .= $listdd.' ';
if(preg_match('/next/i', $listitem))
$plist .= $nextpage.' ';
if(preg_match('/end/i', $listitem))
$plist .= $endpage.' ';
3.设置伪静态规则
我们这里以iis7为例子,设置以下规则:
复制代码代码如下: &?xml version="1.0" encoding="UTF-8"?&&configuration&
&system.webServer&
&rule name="weather1" stopProcessing="true"&
&match url="tags/([^-]+).html$" ignoreCase="true" /&
&conditions logicalGrouping="MatchAll"&
&add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&
&add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&
&/conditions&
&action type="Rewrite" url="/tags.php?/{R:1}" appendQueryString="false" /&
&rule name="weather2" stopProcessing="true"&
&match url="tags/([^-]+)-([0-9]+).html$" ignoreCase="true" /&
&conditions logicalGrouping="MatchAll"&
&add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&
&add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&
&/conditions&
&action type="Rewrite" url="/tags.php?/{R:1}/{R:2}" appendQueryString="false" /&
&/rewrite&
&/system.webServer&&/configuration&&可以直接保存为web.config放在站点根目录。
4.重新生成html页面这个操作就不用说了,全部重新生成下,至此全部修改完毕。
5.预览查看显示结果至此,我们已经完成了所有的设置,可以查看:http://www.**.net/tags/PHP.html语言效果。
★★★ 脚本之家()独家文章,欢迎大家转载 ★★★
文章热词:
美食菜谱推荐
热门关键字百度知道搜索_dedecms 缩略图标签

我要回帖

更多关于 dedecms标签大全 的文章

 

随机推荐