仿站咨询QQ:2587483189

手机微信同号:15850888840

dede内容页URL实现拼音伪静态默认分类

dede内容页URL实现拼音伪静态默认分类
本文为你整理了dede内容页URL实现拼音伪静态的方法,如果你需要可以作为参考:

仿站可能你觉得DEDECMS本来就有这个功能,后台设置下,点生成静态页。。

错了。。我的这个可是动态的,非静态HTML,用urlwrite实现的伪静态。

喜欢的顶。当然要服务器支持urlwrite

好处:
更改模板后,不用重新生成HTML,试试想10W数据,重新生成一遍的难度。

百度收录的友好度。拼音地址。

修改方法
编辑文件
include/inc_channel_unit_functi*****.php
第107行改为
[php]
107                         if($rank!=0||$ismake==-1||$typeid==0||$money>0){ //动态文章
108         //return $GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";
109
110         //keminar 修改
111         $articleDir = MfTypedir($artdir);
112         if($artdir=="") $articleDir   = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
113        
114         return $articleDir."/".GetPinyin($title)."_aid_".$aid.".html";
115    
116     }
[/php]
第52行改为
[php]
52     if($rank!=0||$ismake==-1||$typeid==0||$money>0) //动态文章
53     {
54         if($GLOBALS['cfg_multi_site']=='Y')
55         {
56             $siteurl = $GLOBALS['cfg_basehost'];
57         }
58
59         //return $siteurl.$GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";
60
61         //keminar 修改
62         $articleDir = MfTypedir($artdir);
63         if($artdir=="") $articleDir   = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
64
65         return $siteurl.$articleDir."/".GetPinyin($title)."_aid_".$aid.".html";
66     }
[/php]
第146行改为
[php]
146     if($isdefault==-1)
147     {
148         //$reurl = $GLOBALS["cfg_plus_dir"]."/list.php?tid=".$typeid;
149         //keminar 修改
150         $reurl = $GLOBALS["cfg_cmspath"]."/".$typedir."_tid_".$typeid.".html";
151     }else if($ispart>0)
[/php]
修改文件
include/inc_arclist_view.php
第810行改为
[php]
810
811         $purl = $this->GetCurUrl();
812         //keminar 修改
813         $t = strpos($purl,'_tid_');
814         $purl = substr($purl,0,$t);
815         $geturl = "tid_".$this->TypeID."_";
816         //$hidenform = "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";
817         //$hidenform .= "<input type='hidden' name='totalresult' value='".$this->totalresult."'>\r\n";
818
819         $purl .= "_".$geturl;
820
821         //获得上一页和下一页的链接
822         if($this->pageno != 1){
823             $prepage.="<a href='".$purl."pageno_".$prepagenum.".html'>上一页</a>\r\n";
824             $indexpage="<a href='".$purl."pageno_1.html'>首页</a>\r\n";
825         }
826         else{
827             $indexpage="<a href='#'>首页</a>\r\n";
828         }
829
830         if($this->pageno!=$totalpage && $totalpage>1){
831             $nextpage.="<a href='".$purl."pageno_".$nextpagenum.".html'>下一页</a>\r\n";
832             $endpage="<a href='".$purl."pageno_".$totalpage.".html'>末页</a>\r\n";
833         }
834         else{
835             $endpage="末页\r\n";
836         }
837         //获得数字链接
838         $listdd="";
839         $total_list = $list_len * 2 + 1;
840         if($this->pageno >= $total_list) {
841             $j = $this->pageno-$list_len;
842             $total_list = $this->pageno+$list_len;
843             if($total_list>$totalpage) $total_list=$totalpage;
844         }else{
845             $j=1;
846             if($total_list>$totalpage) $total_list=$totalpage;
847         }
848         for($j;$j<=$total_list;$j++){
849         if($j==$this->pageno) $listdd.= "<strong>$j</strong>\r\n";
850         else $listdd.="<a href='".$purl."pageno_".$j.".html'>".$j."</a>\n";
851         }
852         $plist   =   "";
853         //$plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
854         $plist .= $maininfo.$indexpage.$prepage.$listdd.$nextpage.$endpage;
855         if($totalpage>$total_list){
856             $plist.="<input type='text' name='pageno' id='pageno' value='".$this->pageno."'>\r\n";
857             $plist.="<input type='button' id='button' name='plistgo' value='GO' onclick='plistgo();'>\r\n";
858         }
859         //$plist .= "</form>\r\n";
860         $plist   .=   "<script type='text/javascript'>\r\n
861         function plistgo(){
862             var pageno = document.getElementById(\"pageno\").value;
863             window.location.href='".$purl."pageno_'+pageno+'.html';
864         };</script>";
865
866         return $plist;
[/php]
修改模板
templets/jinsuo/article_image.htm
第10行添加
[php]
10     var url = location.href;
11     var t = url.indexOf('_aid_');
12     var aurl = url.slice(0,t);
[/php]
第42行修改
[php]
42
43             if(npage==2){
44                 if(namehand!='') location.href = namehand+".html";
45                 else location.href = aurl+"_aid_{dede:field name='id'/}"+".html";
46             }else if(displaytype=='st' && namehand!=''){
47                 location.href = namehand+"_"+(npage-1)+".html";
48             }else{
49                 location.href = aurl+"_aid_{dede:field name='id'/}_pageno_"+(npage-1)+".html";
50             }
51         }
52     }
53
54     //下一张
55     function dPlayNext(){
56         if(npage==totalpage){ alert("没有了哦"); }
57         else{
58             if(displaytype=='st' && namehand!='') location.href = namehand+"_"+(npage+1)+".html";
59             else location.href = aurl+"_aid_{dede:field name='id'/}_pageno_"+(npage+1)+".html";                                        
[/php]

 

  • 上一篇:DedeCMS移动文章后原生成的HTML依然存在
  • 下一篇:dedecms取消后台验证码的方法
  • 来源:www.51fangzhan.com//所属分类: 织梦仿站 /更新时间:2010-10-27
    相关仿站教程