pbootcms英文站搜索结果页面包屑和标题翻译

2022-12-07 0 800

在使用pbootcms搭建英文站时会发现搜索结果页的面包屑为中文,标题为英文,该如何处理?可二开增加英文站对应文字来解决。

pbootcms英文站搜索结果页面包屑和标题翻译

修改内容

打开\\apps\\home\\controller\\SearchController.php,把里面的代码全部替换成以下(分为2x和3x版本,对应版本替换):

pb2.1.1版本替换

<?php/***@copyright(C)2020-2099HnaoyunInc.*@authorXingMeng*@emailhnxsh@foxmail.com*@date2020年3月8日*搜索控制器*/namespaceapp\\home\\controller;usecore\\basic\\Controller;classSearchControllerextendsController{protected$parser;protected$htmldir;publicfunction__construct(){$this->parser=newParserController();$this->htmldir=$this->config('tpl_html_dir')?$this->config('tpl_html_dir').'/':'';}//内容搜索@mk-lang增加英语publicfunctionindex(){if(cookie('lg')=='cn'){$searchtpl=request('searchtpl');if(!preg_match('/^[\\w]+\\.html$/',$searchtpl)){$searchtpl='search.html';}$content=parent::parser($this->htmldir.$searchtpl);//框架标签解析$content=$this->parser->parserBefore($content);//CMS公共标签前置解析$pagetitle=get('keyword')?get('keyword').'-':'';$content=str_replace('{pboot:pagetitle}',$this->config('search_title')?:$pagetitle.'搜索结果-{pboot:sitetitle}-{pboot:sitesubtitle}',$content);$content=$this->parser->parserPositionLabel($content,0,'搜索',homeurl('search'));//CMS当前位置标签解析$content=$this->parser->parserSpecialPageSortLabel($content,-1,'搜索结果',homeurl('search'));//解析分类标签$content=$this->parser->parserSearchLabel($content);//搜索结果标签$content=$this->parser->parserAfter($content);//CMS公共标签后置解析echo$content;//搜索页面不缓存exit();}else{$searchtpl=request('searchtpl');if(!preg_match('/^[\\w]+\\.html$/',$searchtpl)){$searchtpl='search.html';}$content=parent::parser($this->htmldir.$searchtpl);//框架标签解析$content=$this->parser->parserBefore($content);//CMS公共标签前置解析$pagetitle=get('keyword')?get('keyword').'-':'';$content=str_replace('{pboot:pagetitle}',$this->config('search_title')?:$pagetitle.'Thesearchresults-{pboot:sitetitle}-{pboot:sitesubtitle}',$content);$content=$this->parser->parserPositionLabel($content,0,'Search',homeurl('search'));//CMS当前位置标签解析$content=$this->parser->parserSpecialPageSortLabel($content,-1,'Thesearchresults',homeurl('search'));//解析分类标签$content=$this->parser->parserSearchLabel($content);//搜索结果标签$content=$this->parser->parserAfter($content);//CMS公共标签后置解析echo$content;//搜索页面不缓存exit();}}}

pb3.0.3版本替换

<?php/***@copyright(C)2020-2099HnaoyunInc.*@authorXingMeng*@emailhnxsh@foxmail.com*@date2020年3月8日*搜索控制器*/namespaceapp\\home\\controller;usecore\\basic\\Controller;usecore\\basic\\Url;classSearchControllerextendsController{protected$parser;protected$htmldir;publicfunction__construct(){$this->parser=newParserController();$this->htmldir=$this->config('tpl_html_dir')?$this->config('tpl_html_dir').'/':'';}//内容搜索publicfunctionindex(){if(cookie('lg')=='cn'){$searchtpl=request('searchtpl');if(!preg_match('/^[\\w]+\\.html$/',$searchtpl)){$searchtpl='search.html';}$content=parent::parser($this->htmldir.$searchtpl);//框架标签解析$content=$this->parser->parserBefore($content);//CMS公共标签前置解析$pagetitle=get('keyword')?get('keyword').'-':'';$content=str_replace('{pboot:pagetitle}',$this->config('search_title')?:$pagetitle.'搜索结果-{pboot:sitetitle}-{pboot:sitesubtitle}',$content);$content=$this->parser->parserPositionLabel($content,0,'搜索',Url::home('search'));//CMS当前位置标签解析$content=$this->parser->parserSpecialPageSortLabel($content,-1,'搜索结果',Url::home('search'));//解析分类标签$content=$this->parser->parserSearchLabel($content);//搜索结果标签$content=$this->parser->parserAfter($content);//CMS公共标签后置解析echo$content;//搜索页面不缓存exit();}else{$searchtpl=request('searchtpl');if(!preg_match('/^[\\w]+\\.html$/',$searchtpl)){$searchtpl='search.html';}$content=parent::parser($this->htmldir.$searchtpl);//框架标签解析$content=$this->parser->parserBefore($content);//CMS公共标签前置解析$pagetitle=get('keyword')?get('keyword').'-':'';$content=str_replace('{pboot:pagetitle}',$this->config('search_title')?:$pagetitle.'Thesearchresults-{pboot:sitetitle}-{pboot:sitesubtitle}',$content);$content=$this->parser->parserPositionLabel($content,0,'Search',Url::home('search'));//CMS当前位置标签解析$content=$this->parser->parserSpecialPageSortLabel($content,-1,'Thesearchresults',Url::home('search'));//解析分类标签$content=$this->parser->parserSearchLabel($content);//搜索结果标签$content=$this->parser->parserAfter($content);//CMS公共标签后置解析echo$content;//搜索页面不缓存exit();}}}

替换效果

pbootcms英文站搜索结果页面包屑和标题翻译

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 PbootCMS教程 pbootcms英文站搜索结果页面包屑和标题翻译 https://www.u-9.cn/cmssyjc/pbootcms-cmssyjc/2079.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务

  • 0 +

    访问总数

  • 0 +

    会员总数

  • 0 +

    文章总数

  • 0 +

    今日发布

  • 0 +

    本周发布

  • 0 +

    运行天数

注册会员,众多资源免费下载