欢迎来到福编程网,本站提供各种互联网专业知识!

DEDECMS 网站优化4则细节

发布时间:2016-08-29 作者:佚名 来源:互联网
大多数站长都很喜欢用dede来建站吧,在建站过程中可能也遇到过这样的问题,废话就不多说了,进入主题,修改前请做好备份!

第一、栏目url标准化

当我用dede建了分类了时候,发现在栏目是带index.html的。

修改前:/abc/index.html

修改后:/abc/

打开文件:include/channelunit.func.php

大概在171行

$reurl = $typedir.'/'.$defaultname;

修改成: $reurl = $typedir.'/';

5.5版本不存在这个问题。

第二、栏目标题美化,去掉栏目斜杠。

修改前:顶级栏目 / 一级栏目

修改后:一级栏目 - 顶级栏目

打开文件:templetsdefaultlist_*.htm

{dede:field.title/} - {dede:global.cfg_webname/}

修改成:{dede:type}[field:typename /]{/dede:type} - {dede:field.title runphp='yes'} $ta = '1';$tb = '/';$tc = @me; $td = split($tb,$tc); @me = $td[$ta-1];{/dede:field.title} - {dede:global.cfg_webname/} ,此方法只适用于二层栏目,希望高手提供更好的方法。

第三、文章分页标题添加序号

修改前:标题、标题、标题

修改后:标题、标题(2)、标题(3)

打开文件:include/arc.archives.class.php

大概在347行修改成以下代码:

//循环生成HTML文件

else

{

for($i=1;$i<=$this->TotalPage;$i++)

{

$tempTitle=$this->Fields['title'];//临时存储一个标题副本 2009.10.28

if($i>1)

{

$truefilename = $this->GetTruePath().$fileFirst."_".$i.".".$this->ShortName;

$this->Fields['title'] = $this->Fields['title'].'('.$i.')';//在标题后面多加个序号 2009.10.28

}

else

{

$truefilename = $this->GetTruePath().$filename;

}

$this->ParseDMFields($i,1);

$this->dtp->SaveTo($truefilename);

$this->Fields['title']=$tempTitle;//生成html,还原标题 2009.10.28

}

}

第四、文章看完了不要忘记了做相关文章推荐哦。

自动关连文档标签引用:

关于{dede:field.title/},其他人还感兴趣的是:

    dede:likearticle row='6' titlelen='42' orderby=rand}

  • [field:title/]
  • {/dede:likearticle}

这些问题相信用dedecms的站长遇到的比较多吧,希望对新手有所帮助,另外还有其他细节就不多说了。

相关推荐