校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 網(wǎng)站建設 > 建站知識 > 織夢CMS實現(xiàn)偽靜態(tài)URL的方法

織夢CMS實現(xiàn)偽靜態(tài)URL的方法

POST TIME:2020-03-28 17:53

我們知道織夢模板可以在后臺直接設置成靜態(tài)HTML,但是如果你是一個數(shù)據(jù)量非常大的網(wǎng)站,更改模板后,重新生成HTML,試試想10W數(shù)據(jù),重新生成一遍的難度。所在這里我想到了一個用urlwrite實現(xiàn)的偽靜態(tài)URL的方法。

提示:用urlwrite實現(xiàn)的偽靜態(tài),服務器支持urlwrite。

修改方法

編輯文件
include/inc_channel_unit_functi*****.php
第107行改為
    if($rank!=0||$ismake==-1||$typeid==0||$money>0){ //動態(tài)文章
    //return $GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";

   //keminar 修改
    $articleDir = MfTypedir($artdir);
    if($artdir=="") $articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
    
    return $articleDir."/".GetPinyin($title)."_aid_".$aid.".html";
  
  }

第52行改為
  if($rank!=0||$ismake==-1||$typeid==0||$money>0) //動態(tài)文章
  {
    if($GLOBALS['cfg_multi_site']=='Y')
    {
      $siteurl = $GLOBALS['cfg_basehost'];
    }

    //return $siteurl.$GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";

    //keminar 修改
    $articleDir = MfTypedir($artdir);
    if($artdir=="") $articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];

    return $siteurl.$articleDir."/".GetPinyin($title)."_aid_".$aid.".html";
  }

第146行改為

  if($isdefault==-1)
  {
    //$reurl = $GLOBALS["cfg_plus_dir"]."/list.php?tid=".$typeid;
    //keminar 修改
    $reurl = $GLOBALS["cfg_cmspath"]."/".$typedir."_tid_".$typeid.".html";
  }else if($ispart>0)

修改文件
include/inc_arclist_view.php
第810行改為

    $purl = $this->GetCurUrl();
    //keminar 修改
    $t = strpos($purl,'_tid_');
    $purl = substr($purl,0,$t);
    $geturl = "tid_".$this->TypeID."_";
    //$hidenform = "<input type='hidden' name='typeid' value='".$this->TypeID."'> ";
    //$hidenform .= "<input type='hidden' name='totalresult' value='".$this->totalresult."'> ";

    $purl .= "_".$geturl;

    //獲得上一頁和下一頁的鏈接
    if($this->pageno != 1){
      $prepage.="<a href='".$purl."pageno_".$prepagenum.".html'>上一頁</a> ";
      $indexpage="<a href='".$purl."pageno_1.html'>首頁</a> ";
    }
    else{
      $indexpage="<a href='#'>首頁</a> ";
    }

    if($this->pageno!=$totalpage && $totalpage>1){
      $nextpage.="<a href='".$purl."pageno_".$nextpagenum.".html'>下一頁</a> ";
      $endpage="<a href='".$purl."pageno_".$totalpage.".html'>末頁</a> ";
    }
    else{
      $endpage="末頁 ";
    }
    //獲得數(shù)字鏈接
    $listdd="";
    $total_list = $list_len * 2 + 1;
    if($this->pageno >= $total_list) {
      $j = $this->pageno-$list_len;
      $total_list = $this->pageno+$list_len;
      if($total_list>$totalpage) $total_list=$totalpage;
    }else{
      $j=1;
     if($total_list>$totalpage) $total_list=$totalpage;
    }
    for($j;$j<=$total_list;$j++){
   if($j==$this->pageno) $listdd.= "<strong>$j</strong> ";
    else $listdd.="<a href='".$purl."pageno_".$j.".html'>".$j."</a> ";
    }
    $plist = "";
   //$plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
    $plist .= $maininfo.$indexpage.$prepage.$listdd.$nextpage.$endpage;
    if($totalpage>$total_list){
      $plist.="<input type='text' name='pageno' id='pageno' value='".$this->pageno."'> ";
     $plist.="<input type='button' id='button' name='plistgo' value='GO' onclick='plistgo();'> ";
    }
   //$plist .= "</form> ";
    $plist .= "<script type='text/javascript'>
    function plistgo(){
      var pageno = document.getElementById(&;pageno&;).value;
      window.location.href='".$purl."pageno_'+pageno+'.html';
    };</script>";
   return $plist;

修改模板
templets/jinsuo/article_image.htm
第10行添加

  var url = location.href;
  var t = url.indexOf('_aid_');
  var aurl = url.slice(0,t);

第42行修改

     if(npage==2){
       if(namehand!='') location.href = namehand+".html";
      else location.href = aurl+"_aid_{dede:field name='id'/}"+".html";
     }else if(displaytype=='st' && namehand!=''){
       location.href = namehand+"_"+(npage-1)+".html";
     }else{
       location.href = aurl+"_aid_{dede:field name='id'/}_pageno_"+(npage-1)+".html";
     }
    }
  }

  //下一張
  function dPlayNext(){
    if(npage==totalpage){ alert("沒有了哦"); }
    else{
      if(displaytype=='st' && namehand!='') location.href = namehand+"_"+(npage+1)+".html";
      else location.href = aurl+"_aid_{dede:field name='id'/}_pageno_"+(npage+1)+".html";    



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266
主站蜘蛛池模板: 棋牌| 巴马| 本溪| 白银市| 华蓥市| 钟祥市| 拉孜县| 阜宁县| 涞水县| 嘉义县| 丽水市| 平顶山市| 仪征市| 芦溪县| 牡丹江市| 安庆市| 平利县| 巫山县| 衡阳县| 高要市| 万源市| 霸州市| 都兰县| 醴陵市| 桦川县| 电白县| 泽普县| 榆树市| 炉霍县| 大荔县| 英山县| 视频| 宿松县| 象山县| 溧阳市| 民县| 普宁市| 达拉特旗| 长乐市| 当雄县| 琼海市|