织梦程序的 文章列表页 首页和列表页第一页是一样的,程序是直接把列表页第一页复制成首页的,这样就会出现两个相同的页面,我们这里介绍如何去除列表页第一页.
第一步:删除重复的类似list_1_1.html这个文件,打开 /include/arc.listview.class.php,搜索以下代码:
copy($list_1,$indexname);
|
在这行代码下面加上:
这样就在生成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);
}
|
找到【 //获得,未页的链接 】,将中间的代码替换为以下代码:
if($this->PageNo != 1)
{
if($prepagenum==1)
{
$prepage.="<li><a href='".$tnamerule1."'>上一页</a></li> ";
}
else
{
$prepage.="<li><a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>上一页</a></li> ";
}
$indexpage="<li><a href='".str_replace("{page}",1,$tnamerule1)."'>首页</a></li> ";
}
|
找到【 //option链接】和【 //获得数字链接】,将中间的代码替换为以下代码:
$optionlist = '';
$optionlen = strlen($totalpage);
$optionlen = $optionlen*12 + 18;
if($optionlen < 36) $optionlen = 36;
if($optionlen > 100) $optionlen = 100;
$optionlist = "<li><select name='sldd' style='width:{$optionlen}px' onchange='location.href=this.options[this.selectedIndex].value;'> ";
for($mjj=1;$mjj<=$totalpage;$mjj++)
{
if($mjj==$this->PageNo)
{
$optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."' selected>$mjj</option> ";
}elseif($mjj==1)
{
$optionlist .= "<option value='".$tnamerule2."'>$mjj</option> ";
}
else
{
$optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."'>$mjj</option> ";
}
}
$optionlist .= "</select></li> ";
|
找到以下代码:
if($j==$this->PageNo)
{
$listdd.= "<li class="thisclass"><a>$j</a></li> ";
}
|
在下面加上以下代码:
elseif($j==1){
$listdd.="<li><a href='".str_replace("{page}",$j,$tnamerule1)."'>".$j."</a></li> ";
}
|
(责任编辑:admin) |