您现在的位置是:首页 > 教程 > pbootcms教程pbootcms教程
pbootcms建站中英文站搜索结果页标题面包屑是中文怎么修改
涵柏2023-01-25 15:05:51pbootcms教程已有人查阅
导读在使用pbootcms搭建英文站时会发现搜索结果页的面包屑为中文,标题为英文,该如何处理?可二次开发来增加英文站对应文字来解决。
在使用pbootcms搭建英文站时会发现搜索结果页的面包屑为中文,标题为英文,该如何处理?可二次开发来增加英文站对应文字来解决。
修改方法
修改方法
<?php
/**
* @copyright (C)2020-2099 Hnaoyun Inc.
* @author XingMeng
* @email hnxsh@foxmail.com
* @date 2020年3月8日
* 搜索控制器
*/
namespace apphomecontroller;
use corebasicController;
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 hnxsh@foxmail.com
* @date 2020年3月8日
* 搜索控制器
*/
namespace apphomecontroller;
use corebasicController;
use corebasicUrl;
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();
}
}
}
本文标签:
很赞哦! ()
相关文章
随机图文
-
pbootcms标签之{/pboot@sql}万能循环标签使用方法
pbootcms V3.0.4 build 2021-02-14版本新增了{pboot@sql sql="语句"}[sql:字段]{/pboot@sql}万能循环标签。 -
PbootCMS指定栏目标签和控制参数介绍
适用范围:全站任意地方均可使用;标签作用:用于调导航菜单栏目列表,对应后台的“基础内容>内容栏目” -
pbootcms内容发布带反斜杠不显示的解决方法
拿pbootcms来做博客的可能会碰到个问题,那就是发布些教程的时候需要添加路径描述时,例如需要显示appscommonroute.php的时候,这里的路径里有反斜杠 -
pbootcms建站中内容详情页自定义模板文件的方法
我们在制作网站的过程中可能会遇到这样的需求,某条新闻、产品设计相对复杂,统一的栏目模板不能解决需求。这时候就需要单独给某个新闻、产品设计一个模板。
留言与评论 (共有 条评论) |