dedecms集权优化小技巧

手册/FAQ (604) 2016-11-11 11:13:21

dedecms集权优化首先要对canonical的写法、织梦Dedecms首页模板的写法、织梦dedecms列表页模板的写法和织梦dedecms内容页模板的写法做些修改,在上面这些写法完成之后才能开始修改配置文件。当内容分页的时候,分页的URL地址就不正确了,那么如何解决当内容分页的时候,分页的URL不正确,下面小编给大家详细介绍。

解决办法:

1.打开/include/arc.archives.class.php 搜索”$TRUEfilename = $this->GetTruePath().$fileFirst."_".$i.".".$this->ShortName;“ 在下面添加一段代码:

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

GLOBAL $cfg_multi_site;

if($cfg_multi_site=='Y') {

$this->Fields['arcurl'] = $cfg_basehost.$fileFirst."_".$i.".".$this->ShortName;

} else {

$this->Fields['arcurl'] = $fileFirst."_".$i.".".$this->ShortName;

}

2.频道页也要做相应的修改,打开/include/arc.listview.class.php 搜索”$this->PartView->SetTemplet($tempfile);“,在其上面添加一段代码:

if(!file_exists($tempfile))

{

$tempfile =$tmpdir."/".$GLOBALS['cfg_df_style']."/index_default.htm";

}

GLOBAL $cfg_multi_site,$cfg_basehost;

if($cfg_multi_site=='Y') {

$this->PartView->Fields['typeurl'] = $cfg_basehost.MfTypedir($this->Fields['typedir']);

} else {

$this->PartView->Fields['typeurl'] = MfTypedir($this->Fields['typedir']);

}

$this->PartView->SetTemplet($tempfile);

3.列表页修改有些麻烦,也会影响到性能,同是/include/arc.listview.class.php,搜索“$this->dtp->SaveTo($makeFile);”,在他前面加上一段代码:

if($this->PageNo == 1) {

$this->Fields['typeurl'] = MfTypedir($this->Fields['typedir']);

} else {

$this->Fields['typeurl'] = $murl;

}

GLOBAL $cfg_multi_site,$cfg_basehost;

if($cfg_multi_site=='Y') {

$this->Fields['typeurl'] = $cfg_basehost.$this->Fields['typeurl'];

}

//初步给固定值的标记赋值

$this->ParseTempletsFirst();

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

THE END