演示链接:查看演示

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

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

 

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

 

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

 

修改文件:/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,还原标题

   }

  }
 

THE END
喜欢就支持一下吧
点赞0 分享