[织梦CMS]织梦双语网站,上一页,下一页,上一篇、下一篇,position修改方法

changhao  于 2018-6-3 10:31:27 回帖奖励 |阅读模式
0 5205
本帖最后由 changhao 于 2018-6-3 10:33 编辑

一、面包屑导航主页替换成英文的方法:
  {dede:field name='position'  function='str_replace("主页","Home",@me)'/}  


二、列表页分页替换成英文的方法:

1、打开include/arc.listview.class.php(本文以DedeCMS5.7为例)
找到(约29行)

var $remoteDir;

在其下面加上一个新行

var $pagelang;

找到(约528行)

$list_len = trim($ctag->GetAtt("listsize"));

在其下面加上一个新行

$pagelang = trim($ctag->GetAtt("pagelang"));

找到(约531行)

if($list_len=="")
{
    $list_len = 3;
}

在其下面加上

if($pagelang=="")
{
    $pagelang = 'cn';
}

修改(约545行)

$this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem));

$this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem,$pagelang));

修改(新增)

function GetPageListST($list_len,$listitem="index,end,pre,next,pageno")

function GetPageListST($list_len,$listitem="index,end,pre,next,pageno",$pagelang='cn')


修改(约826行)

return "<li><span class=\"pageinfo\">共 <strong>1</strong> 页 <strong>".$this->TotalResult."</strong> 条记录</span></li>\r\n";

if($pagelang=='cn') {

   return "<li><span class=\"pageinfo\">共 <strong>1</strong> 页 <strong>".$this->TotalResult."</strong> 条记录</span></li>\r\n";
}
else
{
   return "<li><span class=\"pageinfo\">Total <strong>1</strong> Page <strong> ".$this->TotalResult."</strong> Records</span></li>\r\n";
}

修改

return "<li><span class=\"pageinfo\">共 <strong>0</strong> 页 <strong>".$this->TotalResult."</strong> 条记录</span></li>\r\n";

if($pagelang=='cn') {
    return "<li><span class=\"pageinfo\">共 <strong>0</strong> 页 <strong>".$this->TotalResult."</strong> 条记录</span></li>\r\n";
}
else
{
   return "<li><span class=\"pageinfo\">Total <strong>0</strong> Page <strong> ".$this->TotalResult."</strong> Records</span></li>\r\n";
}

修改

$maininfo = "<li><span class=\"pageinfo\">共 <strong>{$totalpage}</strong> 页 <strong>".$this->TotalResult."</strong> 条</span></li>\r\n";

if($pagelang=='cn') {
   $maininfo = "<li><span class=\"pageinfo\">共 <strong>{$totalpage}</strong> 页 <strong>".$this->TotalResult."</strong> 条</span></li>\r\n";
}
else
{
   $maininfo = "<li><span class=\"pageinfo\">Total <strong>{$totalpage}</strong> Page <strong> ".$this->TotalResult."</strong> Records</span></li>\r\n";
}

依照上面的方法,依次修改下面的获取上一页、主页、下一页、末页的内容

2、打开列表模板页面,我这以list_article_en.htm为例,其中list_article_en.htm为英文版的列表页面模板,中文版的可以不用修改
修改

{dede:pagelist listsize='5'/}

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

重新生成列表页成功。





三、文章内容页上一篇下一篇增加英文版
1.模板文件中调用的方法
li>{dede:prenext get='pre' sitelang='cn'/}</li>
<li>{dede:prenext get='next' sitelang='cn'/}</li>
更改为
<li>{dede:prenext get='pre' sitelang='en'/}</li>
<li>{dede:prenext get='next' sitelang='en'/}</li>

2.打开 include\arc.archives.class.php 文件,找到
$this->dtp->Assign($i,$this->GetPreNext($ctag->GetAtt('get')));  
更改为  
$this->dtp->Assign($i,$this->GetPreNext($ctag->GetAtt('get'), $ctag->GetAtt('sitelang')));


3.然后再找函数 GetPreNext 找到
function GetPreNext($gtype='')  
更改为  
function GetPreNext($gtype='', $site_lang)


4.判断代码,写在
function GetPreNext($gtype='', $site_lang)

    {到 $rs = '';中间


//添加在这里
$str_pre = '';  
$str_next = '';  
$str_pre_words = '';  
$str_next_words = ''; if($site_lang == 'cn')  
{  
$str_pre = '上一篇';  
$str_next = '下一篇';  
$str_pre_words = '上一篇:没有了';  
$str_next_words = '下一篇:没有了';  
}elseif($site_lang == 'en')  
{  
$str_pre = 'Preview';  
$str_next = 'Next';  
$str_pre_words = 'Preview:no';  
$str_next_words = 'Next:no';  
}



5.然后将 if(is_array($preRow)) 里面的上一篇下一篇 上一篇:没有了,下一篇:没有换成变量,找到
$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";  
改为  
$this->PreNext['pre'] = $str_pre .":<a href='$mlink'>{$preRow['title']}</a> ";  
找到  
$this->PreNext['pre'] = "上一篇:没有了 ";  
改为  
$this->PreNext['pre'] = $str_pre_words;  
找到  
$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";  
改为  
$this->PreNext['next'] = $str_next . ":<a href='$mlink'>{$nextRow['title']}</a> ";  
找到  
$this->PreNext['next'] = "下一篇:没有了 ";  
改为  
$this->PreNext['next'] = $str_next_words;

| 0 人收藏
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
回复

使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    • 售后服务
    • 关注我们
    • 社区新手

    QQ|Archiver|手机版|小黑屋|德高网络.  

    Powered by Discuz! X3.2  © 2001-2018 Comsenz Inc.