PbootCMS英文站搜索結果頁面包屑和標題翻譯

2021-11-08 2418 19 編輯:pbhtml 來源:PB資源網

在使用PbootCMS搭建英文站時會發現搜索結果頁的面包屑為中文,標題為英文,該如何處理?可二開增加英文站對應文字來解決。

PbootCMS英文站搜索結果頁面包屑和標題翻譯

修改內容

打開ppshomecontrollerSearchController.php,把里面的代碼全部替換成以下(分為2x和3x版本,對應版本替換):

pb2.1.1版本替換

parser?=?new?ParserController();
????????$this->htmldir?=?$this->config('tpl_html_dir')???$this->config('tpl_html_dir')?.?'/'?:?'';
????}

????//?內容搜索@mk-lang?增加英語
????public?function?index()
????{
????????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?.?'The?search?results-{pboot:sitetitle}-{pboot:sitesubtitle}',?$content);
????????????$content?=?$this->parser->parserPositionLabel($content,?0,?'Search',?homeurl('search'));?//?CMS當前位置標簽解析
????????????$content?=?$this->parser->parserSpecialPageSortLabel($content,?-?1,?'The?search?results',?homeurl('search'));?//?解析分類標簽
????????????$content?=?$this->parser->parserSearchLabel($content);?//?搜索結果標簽
????????????$content?=?$this->parser->parserAfter($content);?//?CMS公共標簽后置解析
????????????echo?$content;?//?搜索頁面不緩存
????????????exit();
????????}
????}
}

pb3.0.3版本替換

parser?=?new?ParserController();
????????$this->htmldir?=?$this->config('tpl_html_dir')???$this->config('tpl_html_dir')?.?'/'?:?'';
????}

????//?內容搜索
????public?function?index()
????{
????????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?.?'The?search?results-{pboot:sitetitle}-{pboot:sitesubtitle}',?$content);
????????????$content?=?$this->parser->parserPositionLabel($content,?0,?'Search',?Url::home('search'));?//?CMS當前位置標簽解析
????????????$content?=?$this->parser->parserSpecialPageSortLabel($content,?-?1,?'The?search?results',?Url::home('search'));?//?解析分類標簽
????????????$content?=?$this->parser->parserSearchLabel($content);?//?搜索結果標簽
????????????$content?=?$this->parser->parserAfter($content);?//?CMS公共標簽后置解析
????????????echo?$content;?//?搜索頁面不緩存
????????????exit();
????????}
????}
}

替換效果

PbootCMS英文站搜索結果頁面包屑和標題翻譯



最后更新于 2020-12-23 22:51:39 本文來源:https://www.pbhtml.com/232.html略有修改

相關知識點: PbootCMS搜索 PbootCMS多語言
本站文章均為蜀戎網絡摘自權威資料,書籍,或網絡原創文章,如有版權糾紛或者違規問題,請即刻聯系我們刪除,未經允許禁止復制轉載!感謝...
更多人喜歡

在線
客服

在線客服服務時間:9:00-21:00

客服
熱線

13227777380
7*24小時客服服務熱線

客服
微信

掃一掃微信咨詢
頂部
最近2019年免费中文字幕电影,最近更新2018中文国语字幕,最近中文字幕2018高清一页,一二三四免费观看视频中文版在线宜宾蜀戎网络公司