Skip to main content
 Web开发网 » 站长学院 » 织梦教程

如何给织梦文章分页标题加上序号呢?

2020年09月12日6460百度已收录

为了方便浏览者的阅读,我们可以在织梦dedeCMS的分页文章标题加上序号。我们先来分析一下,

 

经过研究我们发现织梦模板文章分页所需要的文件是arc.archives.class.php ,

 

所以我们可以通过添加一句代码,为织梦模板文章分页标题加上序号。下面是具体操作过程: 

 

修改文件:/include/arc.archives.class.php 

行数:大约347行 (行数可能由于更新有变化)

修改代码如下:

  //循环生成HTML文件

  else

  {

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

   {

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

    if($i>1)

    {

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

     //为分页标题加上序号。2009.2.13

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

    }

    else

    {

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

    }

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

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

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

   }

  }


 

评论列表暂无评论
发表评论
微信