想自学教程的朋友,就来教程巴巴。
教程巴巴
当前位置: 主页 > 图文 > 网页制作教程 >

织梦dede文章分段标题优化教程(2)

发布时间:2014-04-15 18:05 点击:
分享到:
【评论本教程】 【挑错本教程】
------分隔线----------------------------
把副标题改成自己想要的文字,并在<title></title>里显示呢?答案是肯定的。

我们需要修改的地方是/include/arc.archives.class.php文件,只要把内容改成以下的内容

/**
     *  获得动态页面小标题
     *
     * @access    public
     * @param     string  $styleName  类型名称
     * @param     string  $pageNo  页码数
     * @return    string
     */
    function GetPageTitlesDM($styleName, $pageNo)
    {
        if($this->TotalPage==1)
        {
            return $this->Fields['title'];
        }
        if(count($this->SplitTitles)==0)
        {
            return $this->Fields['title'];
        }
        $i=1;
        $aid = $this->ArcID;
        if($styleName=='link')
        {
            $revalue = "";
            foreach($this->SplitTitles as $k=>$v)
            {
                if($i==1)
                {
                    $revalue .= "<a href='view.php?aid=$aid&pageno=$i'>$v</a> \r\n";
                }
                else
                {
                    if($pageNo==$i)
                    {
                        $revalue .= " $v \r\n";
                    }
                    else
                    {
                        $revalue .= "<a href='view.php?aid=$aid&pageno=$i'>$v</a> \r\n";
                    }
                }
                $i++;
            }
        }
  else if($styleName=='title'){
    $revalue='';
   
    if($this->NowPage=='1'){
       $revalue = $this->Fields['title'];
     }
   else {
     $revalue = $this->SplitTitles[$this->NowPage-1];
   }
   
  }
        else
        {
            $revalue = "<select id='dedepagetitles' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
            foreach($this->SplitTitles as $k=>$v)
            {
                if($i==1)
                {
                    $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>\r\n";
                }
                else
                {
                    if($pageNo==$i)
                    {
                        $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i' selected>{$i}、{$v}</option>\r\n";
                    }
                    else
                    {
                        $revalue .= "<option value='".$this->Fields['phpurl']."/view.php?aid=$aid&pageno=$i'>{$i}、{$v}</option>\r\n";
                    }
                }
                $i++;
            }
            $revalue .= "</select>\r\n";
        }
        return $revalue;
    }

    /**
     *  获得静态页面小标题
     *
     * @access    public
     * @param     string  $styleName  类型名称
     * @param     string  $pageNo  页码数
     * @return    string
     */
    function GetPageTitlesST($styleName, $pageNo)
    {
        if($this->TotalPage==1)
        {
            return $this->Fields['title'];
        }
        if(count($this->SplitTitles)==0)
        {
            return $this->Fields['title'];
        }
        $i=1;
        if($styleName=='link')
        {
            $revalue = "";
            foreach($this->SplitTitles as $k=>$v)
            {
                if($i==1)
                {
                    $revalue .= "<a href='".$this->NameFirst.".".$this->ShortName."'>$v</a> \r\n";
                }
                else
                {
                    if($pageNo==$i)
                    {
                        $revalue .= " $v \r\n";
                    }
                    else
                    {
                        $revalue .= "<a href='".$this->NameFirst."_".$i.".".$this->ShortName."'>$v</a> \r\n";
                    }
                }
                $i++;
            }
        }
  else if($styleName=='title'){
    $revalue='';
   
    if($this->NowPage=='1'){
       $revalue = $this->Fields['title'];
     }
   else {
     $revalue = $this->SplitTitles[$this->NowPage-1];
   }
   
  }
  
        else
        {
            $revalue = "<select id='dedepagetitles' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
            foreach($this->SplitTitles as $k=>$v)
            {
                if($i==1)
                {
                    $revalue .= "<option value='".$this->NameFirst.".".$this->ShortName."'>{$i}、{$v}</option>\r\n";
                }
                else
                {
                    if($pageNo==$i)
                    {
                        $revalue .= "<option value='".$this->NameFirst."_".$i.".".$this->ShortName."' selected>{$i}、{$v}</option>\r\n";
                    }
                    else
                    {
                        $revalue .= "<option value='".$this->NameFirst."_".$i.".".$this->ShortName."'>{$i}、{$v}</option>\r\n";
                    }
                }
                $i++;
            }
            $revalue .= "</select>\r\n";
        }
        return $revalue;
    }


并把要显示的地方用替换{dede:pagetitle style="title"/}

相关文章