本文实例讲述了织梦dedecms将列表页重复的第一页去除的方法。分享给大家供大家参考。具体分析如下:
织梦程序的文章列表页首页和列表页第一页是一样的,程序是直接把列表页第一页复制成首页的,这样就会出现两个相同的页面,我们这里介绍如何去除列表页第一页.
这里特别提醒大家,修改之前,请做好备份.
第一步:删除重复的类似list_1_1.html这个文件,打开 /include/arc.listview.class.php,搜索以下代码:
复制代码
代码如下:
copy($list_1,$indexname);
在这行代码下面加上:
复制代码
代码如下:
unlink($list_1);
这样就在生成html的时候自动将列表第一页删除.
第二步:将所有的分页第一页和首页链接指向首页,找到以下代码:
复制代码
代码如下:
$tnamerule = ereg_replace('^(.*)/','',$tnamerule);
在下面加上:
复制代码
代码如下:
if($this->Fields['ispart']==0&$this->Fields['defaultname']=="index.htm")
{
$tnamerule1 =$this->GetMakeFileRule($this->Fields['id'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule1 = str_replace('index.htm','',$tnamerule1);
$tnamerule2 = ereg_replace('^(.*)/','index.htm',$tnamerule1);
}elseif($this->Fields['ispart']==0&$this->Fields['defaultname']=="index.html")
{
$tnamerule1 =$this->GetMakeFileRule($this->Fields['id'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule1 = str_replace('index.html','',$tnamerule1);
$tnamerule2 = ereg_replace('^(.*)/','index.html',$tnamerule1);
}
else
{
$tnamerule1 =$this->GetMakeFileRule($this->Fields['id'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule2 = ereg_replace('^(.*)/','',$tnamerule1);
}
{
$tnamerule1 =$this->GetMakeFileRule($this->Fields['id'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule1 = str_replace('index.htm','',$tnamerule1);
$tnamerule2 = ereg_replace('^(.*)/','index.htm',$tnamerule1);
}elseif($this->Fields['ispart']==0&$this->Fields['defaultname']=="index.html")
{
$tnamerule1 =$this->GetMakeFileRule($this->Fields['id'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule1 = str_replace('index.html','',$tnamerule1);
$tnamerule2 = ereg_replace('^(.*)/','index.html',$tnamerule1);
}
else
{
$tnamerule1 =$this->GetMakeFileRule($this->Fields['id'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule2 = ereg_replace('^(.*)/','',$tnamerule1);
}
找到【 //获得上一页和主页的链接 】和【 //下一页,未页的链接 】,将中间的代码替换为以下代码:
复制代码
代码如下:
if($this->PageNo != 1)
{
if($prepagenum==1)
{
$prepage.="上一页 \r\n";
}
else
{
$prepage.="上一页 \r\n";
}
$indexpage="首页 \r\n";
}
{
if($prepagenum==1)
{
$prepage.="
}
else
{
$prepage.="
}
$indexpage="
}
找到【 //option链接】和【 //获得数字链接】,将中间的代码替换为以下代码:
复制代码
代码如下:
$optionlist = '';
$optionlen = strlen($totalpage);
$optionlen = $optionlen*12 + 18;
if($optionlen < 36) $optionlen = 36;
if($optionlen > 100) $optionlen = 100;
$optionlist = "\r\n";
$optionlen = strlen($totalpage);
$optionlen = $optionlen*12 + 18;
if($optionlen < 36) $optionlen = 36;
if($optionlen > 100) $optionlen = 100;
$optionlist = "\r\n";
找到以下代码:
复制代码
代码如下:
在下面加上以下代码:
复制代码
代码如下:
希望本文所述对大家的dedecms建站有所帮助。