pbootcms英文站搜索結果頁面包屑和標題翻譯
作者(zhe):PB模板網
時間:2020-12-20 22:42:16
瀏覽:3073
點贊:358
在使用pbootcms搭建英文站時會發現搜索結果頁的面包屑為中文,標題為英文,該如何處理?可二開增加英文站對應文字來解決。
修改內容
打(da)開\apps\home\controller\SearchController.php,把里面的代(dai)碼全部(bu)替換成以下(xia)(分為(wei)2x和(he)3x版本,對應版本替換):
pb2.1.1版本替換
<?php /** * @copyright (C)2020-2099 Hnaoyun Inc. * @author XingMeng * @email * @date 2020年3月8日 * 搜索控制器 */ namespace app\home\controller; use core\basic\Controller; class SearchController extends Controller { protected $parser; protected $htmldir; public function __construct() { $this->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版本替換
<?php /** * @copyright (C)2020-2099 Hnaoyun Inc. * @author XingMeng * @email * @date 2020年3月8日 * 搜索控制器 */ namespace app\home\controller; use core\basic\Controller; use core\basic\Url; class SearchController extends Controller { protected $parser; protected $htmldir; public function __construct() { $this->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(); } } }
替換效果
文章鏈接://bilinxiyi.cn/232.html
文章標題:pbootcms英文站搜索結果頁面包屑和標題翻譯
文章版權:PB模板網 (bilinxiyi.cn) 所發布的內容,部分為原創文章,轉載請注明來源,網絡轉載文章如有侵權請聯系我們!
本文最后更新發布于
文章標題:pbootcms英文站搜索結果頁面包屑和標題翻譯
文章版權:PB模板網 (bilinxiyi.cn) 所發布的內容,部分為原創文章,轉載請注明來源,網絡轉載文章如有侵權請聯系我們!
本文最后更新發布于
2022-11-28 18:02:20
,某些文章具有時效性,若有錯誤或已失效,請在下方留言或聯系客服: