當前位置:紅帽SEO工作室 pbootcms教程 PbootCMS英文站搜索效果頁面包屑顯示中文的修改方法
→ 西部數碼官網正品獨享云虛擬主機火熱促銷中!買2年送一年,買3年送2年,買5年送5年! ←
→ 如有資源無法下載,請第一時間聯系站長QQ:23467321處理!誠信讓我們共贏!
→ 為更好的溝通和解決用戶需求,建議新老用戶都采用QQ郵箱來注冊賬號!
→ 如有資源無法下載,請第一時間聯系站長QQ:23467321處理!誠信讓我們共贏!
→ 為更好的溝通和解決用戶需求,建議新老用戶都采用QQ郵箱來注冊賬號!
PbootCMS英文站搜索效果頁面包屑顯示中文的修改方法
修改內容
打開\apps\home\controller\SearchController.php,把里面的代碼全部替換成以下(分為2x和3x版本,對應版本替換):
pb2.1.1版本替換
/** * @copyright (C)2020-2099 Hnaoyun Inc. * @author XingMeng * @email hnxsh@foxmail.com * @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版本替換
/** * @copyright (C)2020-2099 Hnaoyun Inc. * @author XingMeng * @email hnxsh@foxmail.com * @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(); } } }
替換效果