请选择 进入手机版 | 继续访问电脑版

织梦中英文站点英文分页修改的方法教程(亲测可用)附新织梦加固版/原版织梦

[复制链接]
查看3707 | 回复1 | 2019-7-29 10:11 | 显示全部楼层 |阅读模式
织梦中英文站点英文分页修改的方法教程(亲测可用)附新织梦加固版/原版织梦

首页我们上次介绍了<<DEDE织梦如何做中英文多语言站>>,但是有些细节还是无法满足英文站,比如列表分页出现“首页 上一页 下一页 末页”、当前位置:首页>about>,这样的问题改如何解决呢?今天就跟着自丢网技术工程师一起来学学吧。

1:列表分页英文设置教程
用arc.listview.class.php覆盖include/arc.listview.class.php
调用方法:
{dede:pagelist listsize='5'/}
{dede:pagelist pagelang='en' listsize='5'/}  
pagelang:en为英文,cn为中文,默认语言中文



  1. /**
  2.      *  获取静态的分页列表
  3.      *
  4.      * @access    public
  5.      * @param     string  $list_len  列表宽度
  6.      * @param     string  $list_len  列表样式
  7.      * @return    string
  8.      */
  9.     function GetPageListST($list_len,$listitem="index,end,pre,next,pageno",$pagelang)
  10.     {
  11.                     /*****************************************************************************************/
  12.                       if($pagelang='cn'){
  13.                                 $uahome="首页";
  14.                                $uaprevious="上一页";
  15.                                $uanext="下一页";
  16.                                $ualastpage="末页";
  17.                                $uapage="页";
  18.                                $uatotal="共";
  19.                                $uarecords="条记录";
  20.                             }else{
  21.                               $uahome=" Home ";
  22.                                $uaprevious=" Previous ";
  23.                                $uanext=" Next ";
  24.                                $ualastpage=" Last Page ";
  25.                                $uapage=" Page ";
  26.                                $uatotal=" Total ";
  27.                                $uarecords=" Records. ";
  28.                           }
  29.                     
  30.         $prepage = $nextpage = '';
  31.         $prepagenum = $this->PageNo-1;
  32.         $nextpagenum = $this->PageNo+1;
  33.         if($list_len=='' || ereg("[^0-9]",$list_len))
  34.         {
  35.             $list_len=3;
  36.         }
  37.         $totalpage = ceil($this->TotalResult/$this->PageSize);
  38.         if($totalpage<=1 && $this->TotalResult>0)
  39.         {
  40.            return "<li><span class="pageinfo">".$uatotal." <strong>1</strong> ".$uapage." <strong>".$this->TotalResult."</strong>

  41. ".$uarecords."</span></li> ";
  42.         }
  43.         if($this->TotalResult == 0)
  44.         {
  45.         return "<li><span class="pageinfo">".$uatotal." <strong>0</strong> ".$uapage." <strong>".$this->TotalResult."</strong>

  46. ".$uarecords."</span></li> ";
  47.   
  48.         }
  49.         $purl = $this->GetCurUrl();
  50.               $maininfo = "<li><span class="pageinfo">".$uatotal." <strong>{$totalpage}</strong> ".$uapage." <strong>".$this->TotalResult."</strong>

  51. ".$uarecords."</span></li> ";
  52.            
  53.         $tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields

  54. ['namerule2']);
  55.         $tnamerule = ereg_replace('^(.*)/','',$tnamerule);

  56.         //获得上一页和主页的链接
  57.         if($this->PageNo != 1)
  58.         {
  59.             $prepage.="<li><a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>".$uaprevious."</a></li> ";
  60.             $indexpage="<li><a href='".str_replace("{page}",1,$tnamerule)."'>".$uahome."</a></li> ";
  61.         }
  62.         else
  63.         {
  64.             $indexpage="<li>".$uahome."</li> ";
  65.         }

  66.         //下一页,未页的链接
  67.         if($this->PageNo!=$totalpage && $totalpage>1)
  68.         {
  69.             $nextpage.="<li><a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>".$uanext."</a></li> ";
  70.             $endpage="<li><a href='".str_replace("{page}",$totalpage,$tnamerule)."'>".$ualastpage."</a></li> ";
  71.         }
  72.         else
  73.         {
  74.             $endpage="<li>".$ualastpage."</li> ";
  75.         }

  76.         //option链接
  77.         $optionlist = '';

  78.         $optionlen = strlen($totalpage);
  79.         $optionlen = $optionlen*12 + 18;
  80.         if($optionlen < 36) $optionlen = 36;
  81.         if($optionlen > 100) $optionlen = 100;
  82.         $optionlist = "<li><select name='sldd' style='width:{$optionlen}px' onchange='location.href=this.options[this.selectedIndex].value;'> ";
  83.         for($mjj=1;$mjj<=$totalpage;$mjj++)
  84.         {
  85.             if($mjj==$this->PageNo)
  86.             {
  87.                 $optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."' selected>$mjj</option> ";
  88.             }
  89.             else
  90.             {
  91.                 $optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."'>$mjj</option> ";
  92.             }
  93.         }
  94.         $optionlist .= "</select></li> ";

  95.         //获得数字链接
  96.         $listdd="";
  97.         $total_list = $list_len * 2 + 1;
  98.         if($this->PageNo >= $total_list)
  99.         {
  100.             $j = $this->PageNo-$list_len;
  101.             $total_list = $this->PageNo+$list_len;
  102.             if($total_list>$totalpage)
  103.             {
  104.                 $total_list=$totalpage;
  105.             }
  106.         }
  107.         else
  108.         {
  109.             $j=1;
  110.             if($total_list>$totalpage)
  111.             {
  112.                 $total_list=$totalpage;
  113.             }
  114.         }
  115.         for($j;$j<=$total_list;$j++)
  116.         {
  117.             if($j==$this->PageNo)
  118.             {
  119.                 $listdd.= "<li class="thisclass">$j</li> ";
  120.             }
  121.             else
  122.             {
  123.                 $listdd.="<li><a href='".str_replace("{page}",$j,$tnamerule)."'>".$j."</a></li> ";
  124.             }
  125.         }
  126.         $plist = '';
  127.         if(preg_match('/index/i', $listitem)) $plist .= $indexpage;
  128.         if(preg_match('/pre/i', $listitem)) $plist .= $prepage;
  129.         if(preg_match('/pageno/i', $listitem)) $plist .= $listdd;
  130.         if(preg_match('/next/i', $listitem)) $plist .= $nextpage;
  131.         if(preg_match('/end/i', $listitem)) $plist .= $endpage;
  132.         if(preg_match('/option/i', $listitem)) $plist .= $optionlist;
  133.         if(preg_match('/info/i', $listitem)) $plist .= $maininfo;
  134.         
  135.         return $plist;
  136.     }
复制代码
2:{dede:field name='position'}中英文双语
替换前面的“首页”两成“Home”就行了,后台的栏目用英文就行
标签:{dede:field name='position'  function='str_replace("首页","Home",Html2Text("@me"))'/}


懒人直接下载附件覆盖include/arc.listview.class.php文件:
新织梦加固版.rar (9.37 KB, 下载次数: 0, 售价: 1 丢币)
admin | 2019-7-29 10:12 | 显示全部楼层
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

UID
1
贡献
387
丢币
38902
主题
4607
回帖
116
注册时间
2018-9-25
最后登录
2024-3-24