网络建站知识

精准传达 • 价值共享

洞悉互联网前沿资讯,探寻网站营销规律

织梦翻页增加英文

作者:Smileby陌少羽 | 2017-11-05 12:08 |点击:

首先需要找到安装目录下的include/arc.listview.class.php

 (一)直接下载arc.listview.class.php   并且替换掉include/arc.listview.class.php皆可

 

上面代码已经做了如下的修改:

1、添加变量$pagelang

2、从页面中读取数据,并去除空格

3、找到里面的2个同名方法 GetPageListDM()--动态和静态的

将里面的方法进行如下替换

 

[php] view plain copy
 
  1.    /** 
  2.     *  获取静态的分页列表 
  3.     * 
  4.     * @access    public 
  5.     * @param     string  $list_len  列表宽度 
  6.     * @param     string  $list_len  列表样式 
  7.     * @return    string 
  8.     */  
  9.     //获取静态的分页列表  
  10. function GetPageListST($list_len,$listitem="index,end,pre,next,pageno",$pagelang)  
  11. {  
  12.                 /*****************************************************************************************/  
  13.                  if($pagelang=='en'){  
  14.                           $uahome=" Home ";  
  15.                       $uaprevious=" Previous ";  
  16.                       $uanext=" Next ";  
  17.                       $ualastpage=" Last Page ";  
  18.                       $uapage=" Page ";  
  19.                       $uatotal=" Total ";  
  20.                       $uarecords=" Records. ";  
  21.                        }else{  
  22.                       $uahome="首页";  
  23.                       $uaprevious="上一页";  
  24.                       $uanext="下一页";  
  25.                       $ualastpage="末页";  
  26.                       $uapage="页";  
  27.                       $uatotal="共";  
  28.                       $uarecords="条记录";  
  29.                            
  30.                     }  
  31.                   
  32.     $prepage = $nextpage = '';  
  33.     $prepagenum = $this->PageNo-1;  
  34.     $nextpagenum = $this->PageNo+1;  
  35.     if($list_len=='' || ereg("[^0-9]",$list_len))  
  36.     {  
  37.         $list_len=3;  
  38.     }  
  39.     $totalpage = ceil($this->TotalResult/$this->PageSize);  
  40.     if($totalpage<=1 && $this->TotalResult>0)  
  41.     {  
  42.          return "<li><span class=\"pageinfo\">".$uatotal." <strong>1</strong> ".$uapage." <strong>".$this->TotalResult."</strong> ".$uarecords."</span></li>\r\n";  
  43.     }  
  44.     if($this->TotalResult == 0)  
  45.     {  
  46.        return "<li><span class=\"pageinfo\">".$uatotal." <strong>0</strong> ".$uapage." <strong>".$this->TotalResult."</strong> ".$uarecords."</span></li>\r\n";  
  47.    
  48.     }  
  49.     $purl = $this->GetCurUrl();  
  50.              $maininfo = "<li><span class=\"pageinfo\">".$uatotal." <strong>{$totalpage}</strong> ".$uapage." <strong>".$this->TotalResult."</strong> ".$uarecords."</span></li>\r\n";  
  51.           
  52.     $tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);  
  53.     $tnamerule = ereg_replace('^(.*)/','',$tnamerule);  
  54.   
  55.   
  56.   
  57.   
  58.   
  59.   
  60.     //获得上一页和主页的链接  
  61.     if($this->PageNo != 1)  
  62.     {  
  63.         $prepage.="<li><a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>".$uaprevious."</a></li>\r\n";  
  64.         $indexpage="<li><a href='".str_replace("{page}",1,$tnamerule)."'>".$uahome."</a></li>\r\n";  
  65.     }  
  66.     else  
  67.     {  
  68.         $indexpage="<li>".$uahome."</li>\r\n";  
  69.     }  
  70.   
  71.     //下一页,未页的链接  
  72.     if($this->PageNo!=$totalpage && $totalpage>1)  
  73.     {  
  74.         $nextpage.="<li><a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>".$uanext."</a></li>\r\n";  
  75.         $endpage="<li><a href='".str_replace("{page}",$totalpage,$tnamerule)."'>".$ualastpage."</a></li>\r\n";  
  76.     }  
  77.     else  
  78.     {  
  79.         $endpage="<li>".$ualastpage."</li>\r\n";  
  80.     }  
  81.   
  82.     //option链接  
  83.     $optionlist = '';  
  84.   
  85.     $optionlen = strlen($totalpage);  
  86.     $optionlen = $optionlen*12 + 18;  
  87.     if($optionlen < 36) $optionlen = 36;  
  88.     if($optionlen > 100) $optionlen = 100;  
  89.     $optionlist = "<li><select name='sldd' style='width:{$optionlen}px' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";  
  90.     for($mjj=1;$mjj<=$totalpage;$mjj++)  
  91.     {  
  92.         if($mjj==$this->PageNo)  
  93.         {  
  94.             $optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."' selected>$mjj</option>\r\n";  
  95.         }  
  96.         else  
  97.         {  
  98.             $optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."'>$mjj</option>\r\n";  
  99.         }  
  100.     }  
  101.     $optionlist .= "</select></li>\r\n";  
  102.   
  103.     //获得数字链接  
  104.     $listdd="";  
  105.     $total_list = $list_len * 2 + 1;  
  106.     if($this->PageNo >= $total_list)  
  107.     {  
  108.         $j = $this->PageNo-$list_len;  
  109.         $total_list = $this->PageNo+$list_len;  
  110.         if($total_list>$totalpage)  
  111.         {  
  112.             $total_list=$totalpage;  
  113.         }  
  114.     }  
  115.     else  
  116.     {  
  117.         $j=1;  
  118.         if($total_list>$totalpage)  
  119.         {  
  120.             $total_list=$totalpage;  
  121.         }  
  122.     }  
  123.     for($j;$j<=$total_list;$j++)  
  124.     {  
  125.         if($j==$this->PageNo)  
  126.         {  
  127.             $listdd.= "<li class=\"thisclass\">$j</li>\r\n";  
  128.         }  
  129.         else  
  130.         {  
  131.             $listdd.="<li><a href='".str_replace("{page}",$j,$tnamerule)."'>".$j."</a></li>\r\n";  
  132.         }  
  133.     }  
  134.     $plist = '';  
  135.     if(eregi('index',$listitem)) $plist .= $indexpage;  
  136.     if(eregi('pre',$listitem)) $plist .= $prepage;  
  137.     if(eregi('pageno',$listitem)) $plist .= $listdd;  
  138.     if(eregi('next',$listitem)) $plist .= $nextpage;  
  139.     if(eregi('end',$listitem)) $plist .= $endpage;  
  140.     if(eregi('option',$listitem)) $plist .= $optionlist;  
  141.     if(eregi('info',$listitem)) $plist .= $maininfo;  
  142.       
  143.     return $plist;  
  144. }  
  145.   
  146.      /** 
  147.     *  获取动态的分页列表 
  148.     * 
  149.     * @access    public 
  150.     * @param     string  $list_len  列表宽度 
  151.     * @param     string  $list_len  列表样式 
  152.     * @return    string 
  153.     */  
  154. function GetPageListDM($list_len,$listitem="index,end,pre,next,pageno",$pagelang)  
  155. {  
  156. /*****************************************************************************************/  
  157.                  if($pagelang=='en'){  
  158.                           $uahome=" Home ";  
  159.                       $uaprevious=" Previous ";  
  160.                       $uanext=" Next ";  
  161.                       $ualastpage=" Last Page ";  
  162.                       $uapage=" Page ";  
  163.                       $uatotal=" Total ";  
  164.                       $uarecords=" Records. ";  
  165.                        }else{  
  166.                       $uahome="首页";  
  167.                       $uaprevious="上一页";  
  168.                       $uanext="下一页";  
  169.                       $ualastpage="末页";  
  170.                       $uapage="页";  
  171.                       $uatotal="共";  
  172.                       $uarecords="条记录";  
  173.                            
  174.                     }  
  175.     global $cfg_rewrite;  
  176.     $prepage = $nextpage = '';  
  177.     $prepagenum = $this->PageNo-1;  
  178.     $nextpagenum = $this->PageNo+1;  
  179.     if($list_len=='' || ereg("[^0-9]",$list_len))  
  180.     {  
  181.         $list_len=3;  
  182.     }  
  183.     $totalpage = ceil($this->TotalResult/$this->PageSize);  
  184.     if($totalpage<=1 && $this->TotalResult>0)  
  185.     {  
  186.         return "<li><span class=\"pageinfo\">".$uatotal." 1 ".$uapage."/".$this->TotalResult."".$uarecords."</span></li>\r\n";  
  187.     }  
  188.     if($this->TotalResult == 0)  
  189.     {  
  190.         return "<li><span class=\"pageinfo\">".$uatotal." 0 ".$uapage."/".$this->TotalResult."".$uarecords."</span></li>\r\n";  
  191.     }  
  192.     $maininfo = "<li><span class=\"pageinfo\">".$uatotal." <strong>{$totalpage}</strong>".$uapage."<strong>".$this->TotalResult."</strong>".$uarecords."</span></li>\r\n";  
  193.       
  194.     $purl = $this->GetCurUrl();  
  195.     if($cfg_rewrite == 'Y')  
  196.     {  
  197.         $nowurls = ereg_replace("\-"".php?"$purl);  
  198.         $nowurls = explode("?"$nowurls);  
  199.         $purl = $nowurls[0];  
  200.     }  
  201.   
  202.     $geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";  
  203.     $purl .= '?'.$geturl;  
  204.       
  205.     $optionlist = '';  
  206.     //$hidenform = "<input type='hidden' name='tid' value='".$this->TypeID."'>\r\n";  
  207.     //$hidenform .= "<input type='hidden' name='TotalResult' value='".$this->TotalResult."'>\r\n";  
  208.   
  209.     //获得上一页和下一页的链接  
  210.     if($this->PageNo != 1)  
  211.     {  
  212.         $prepage.="<li><a href='".$purl."PageNo=$prepagenum'>".$uaprevious."</a></li>\r\n";  
  213.         $indexpage="<li><a href='".$purl."PageNo=1'>".$uahome."</a></li>\r\n";  
  214.     }  
  215.     else  
  216.     {  
  217.         $indexpage="<li><a>".$uahome."</a></li>\r\n";  
  218.     }  
  219.     if($this->PageNo!=$totalpage && $totalpage>1)  
  220.     {  
  221.         $nextpage.="<li><a href='".$purl."PageNo=$nextpagenum'>".$uanext."</a></li>\r\n";  
  222.         $endpage="<li><a href='".$purl."PageNo=$totalpage'>".$ualastpage."</a></li>\r\n";  
  223.     }  
  224.     else  
  225.     {  
  226.         $endpage="<li><a>".$ualastpage."</a></li>\r\n";  
  227.     }  
  228.   
  229.   
  230.     //获得数字链接  
  231.     $listdd="";  
  232.     $total_list = $list_len * 2 + 1;  
  233.     if($this->PageNo >= $total_list)  
  234.     {  
  235.         $j = $this->PageNo-$list_len;  
  236.         $total_list = $this->PageNo+$list_len;  
  237.         if($total_list>$totalpage)  
  238.         {  
  239.             $total_list=$totalpage;  
  240.         }  
  241.     }  
  242.     else  
  243.     {  
  244.         $j=1;  
  245.         if($total_list>$totalpage)  
  246.         {  
  247.             $total_list=$totalpage;  
  248.         }  
  249.     }  
  250.     for($j;$j<=$total_list;$j++)  
  251.     {  
  252.         if($j==$this->PageNo)  
  253.         {  
  254.             $listdd.= "<li class=\"thisclass\"><a>$j</a></li>\r\n";  
  255.         }  
  256.         else  
  257.         {  
  258.             $listdd.="<li><a href='".$purl."PageNo=$j'>".$j."</a></li>\r\n";  
  259.         }  
  260.     }  
  261.   
  262.     $plist = '';  
  263.     if(eregi('index',$listitem)) $plist .= $indexpage;  
  264.     if(eregi('pre',$listitem)) $plist .= $prepage;  
  265.     if(eregi('pageno',$listitem)) $plist .= $listdd;  
  266.     if(eregi('next',$listitem)) $plist .= $nextpage;  
  267.     if(eregi('end',$listitem)) $plist .= $endpage;  
  268.     if(eregi('option',$listitem)) $plist .= $optionlist;  
  269.     if(eregi('info',$listitem)) $plist .= $maininfo;  
  270.       
  271.     if($cfg_rewrite == 'Y')  
  272.     {  
  273.         $plist = str_replace('.php?tid=''-'$plist);  
  274.         $plist = str_replace('&TotalResult=''-'$plist);  
  275.         $plist = preg_replace("/&PageNo=(\d+)/i",'-\\1.html',$plist);  
  276.     }  
  277.     return $plist;  
  278. }  

 

 

 

注意是修改方法的参数,为其添加$pagelang个参数;

 

 

(二)在页面中可以调用


         {dede:pagelist listsize='5'/}
         {dede:pagelist pagelang='en' listsize='5'/}

pagelang:en为英文,cn为中文,默认语言中文


其他功能可以自行扩展

这样织梦的分页的英文就做好了

 
如没特殊注明,文章均为狐灵科技原创,转载请注明  https://www.hulingweb.cn/jzzs/162.html
多一份免费策划方案,总有益处。

请直接添加技术总监微信联系咨询

网站设计 品牌营销

多一份参考,总有益处

联系狐灵科技,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:023-68168040 / 大客户专线:15523356218