设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 手机 数据 公司
当前位置: 首页 > 运营中心 > 建站资源 > 经验 > 正文

dedecms5.7文章实现阅读全文功能二次开发(2)

发布时间:2021-12-13 13:28 所属栏目:19 来源:互联网
导读:/U, ,$this-Fields[body2]); $this-SplitFields = explode(#p2222#,$this-Fields[body2]); $this-Fields[tmptitle] = (emptyempty($this-Fields[tmptitle]) ? $this-Fields[title] : $this-Fields[tmptitle]); $this
/U', '',$this->Fields['body2']);
 $this->SplitFields = explode("#p2222#",$this->Fields['body2']);
 $this->Fields['tmptitle'] = (emptyempty($this->Fields['tmptitle']) ? $this->Fields['title'] : $this->Fields['tmptitle']);
 $this->Fields['title'] = $this->Fields['tmptitle'];
 $this->TotalPage = count($this->SplitFields);
 $this->Fields['totalpage'] = $this->TotalPage;
 $TRUEfilenameall = $this->GetTruePath().$fileFirst."_all.".$this->ShortName;
 $this->ParseDMFields(1,0);
 $this->dtp->SaveTo($TRUEfilenameall);
        
 if($cfg_remote_site=='Y' && $isremote == 1)
 {
        
  //分析远程文件路径
  $remotefile = str_replace(DEDEROOT, '', $TRUEfilename);
  $localfile = '..'.$remotefile;
  //创建远程文件夹
  $remotedir = preg_replace("#[^\/]*\.html#", '', $remotefile);
  $this->ftp->rmkdir($remotedir);
  $this->ftp->upload($localfile, $remotefile, 'ascii');
 }  //Cuoxin.com
}
//阅读全文结束
第三步:查找 获得静态页面分页列表,代码如下:
 
/**
 *  获得静态页面分页列表
 *
 * @access    public
 * @param     int   $totalPage  总页数
 * @param     int   $nowPage  当前页数
 * @param     int   $aid  文档id
 * @return    string
 */
  function GetPagebreak($totalPage, $nowPage, $aid)
{
    if($totalPage==1)
    {
        return "";
    }
    //$PageList = "<li><a>共".$totalPage."页: </a></li>";
    $PageList = "";
    $nPage = $nowPage-1;
    $lPage = $nowPage+1;
    if($nowPage==1)
    {
        $PageList.="<a href='javascript:void(0);'><</a>";
    }
    else
    {
        if($nPage==1)
        {
            $PageList.="<a href='".$this->NameFirst.".".$this->ShortName."' target='_self'><</a>";
        }
        else
        {
            $PageList.="<a href='".$this->NameFirst."_".$nPage.".".$this->ShortName."' target='_self'><</a>";
        }
    }
    for($i=1;$i<=$totalPage;$i++)
    {
        if($i==1)
        {
            if($nowPage!=1)
            {
                $PageList.="<a href='".$this->NameFirst.".".$this->ShortName."' target='_self'>1</a>";
            }
            else
            {
                $PageList.="<a class=\"here\" href='javascript:void(0);' target='_self'>1</a>";
            }
        }
        else
        {
            $n = $i;
            if($nowPage!=$i)
            {
                $PageList.="<a href='".$this->NameFirst."_".$i.".".$this->ShortName."' target='_self'>".$n."</a>";
            }
            else
            {
                $PageList.="<a class=\"here\" href='javascript:void(0);' target='_self'>{$n}</a>";
            }
        }
    }
    if($lPage <= $totalPage)
    {
        $PageList.="<a href='".$this->NameFirst."_".$lPage.".".$this->ShortName."' target='_self'>></a>";
    }
    else
    {
        $PageList.= "<a href='javascript:void(0);'>></a>";
    }
       $PageList.= "<a href='".$this->NameFirst."_all.".$this->ShortName."'>阅读全文</a>";
    return $PageList;
}
也就是在return $PageList 上一行添加了一行代码:
 
$PageList.= "<a href='".$this->NameFirst."_all.".$this->ShortName."'>阅读全文</a>";
 
修改完成后,保存文件,更新一下页面就可以看到效果了.

(编辑:ASP站长网)

网友评论
推荐文章
    热点阅读