在dedecmsCMSdedecms的程序中,其实也有一些重复的页面,想要优化URL,这样的情况是不可能存在的,就比如你列表页的第一页,www.localhost.com/xinwenzhongxin/index.html,但是生成之后也会出现www.localhost.com/xinwenzhongxin/list_1_1.html,所以这样就会对优化存在很大的问题。修改的方法:
1、找到\\include\\arc.listview.class.php这个文件,将
$typedir= ereg_replace('{cmspath}',$GLOBALS['cfg_cmspath'],$this->Fields['typedir']);;
这段代码添加到”//获得上一页和主页的链接”前面;
2、找到下面几行代码(就在”//获得上一页和主页的链接”下面)
if($this->PageNo != 1) { $prepage.="<li><a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>上一页</a></li>\\r\\n"; $indexpage=”<li><a href='".str_replace("{page}",1,$tnamerule)."'>首页</a></li>\\r\\n"; } 改成: if($this->PageNo != 1) { if($prepagenum==1) { $prepage.="<li><a href=\\"".$typedir."/\\">上一页</a></li>\\r\\n"; } else { $prepage.="<li><a href=\\"".str_replace("{page}",$prepagenum,$tnamerule)."\\">上一页</a></li>\\r\\n"; } $indexpage="<li><a href=\\"".$typedir."/\\">首页</a></li>\\r\\n"; }
3、找到
$listdd.="<a href='".str_replace("{page}",$j,$tnamerule)."'>".$j."</a>\\r\\n";
改成:
if($j==1) { $listdd.="<li><a href=\\"".$typedir."/\\">".$j."</a></li>\\r\\n"; } else { $listdd.="<li><a href=\\"".str_replace("{page}",$j,$tnamerule)."\\">".$j."</a></li>\\r\\n";
THE END