您现在的位置是:首页 > cms教程 > PbootCMS教程PbootCMS教程

pbootcms建站中英文站搜索结果页标题面包屑是中文怎么修改

涵柏2023-01-25PbootCMS教程已有人查阅

导读在使用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();
        }
    }
}

本文标签:

很赞哦! ()

相关源码

  • 帝国cms7.5手游评测资讯礼包合集游戏专区下载网站模板本模板基于帝国CMS系统开发,为手游门户网站设计。支持PC端与移动端同步生成HTML静态页面,内置多端同步生成功能。模板架构针对手业特点优化,满足APP下载、游戏资讯、攻略等内容发布需求。查看源码
  • 帝国CMS游戏应用APP推广下载站模板免费下载本模板为移动应用推广、手机游戏推广行业设计,集成H5游戏平台与APP下载功能,支持PC端与移动端自适应访问。专注于为应用开发商、游戏发行商提供专业的线上推广展示平台。查看源码
  • 帝国cms大气淘宝客网站源码带手机版带火车头采集本款创意礼物导购网站模板为礼物类电商平台设计,采用清爽简约的界面风格,具备完善的商品导购功能。系统支持在文章攻略中灵活插入商品购买链接,实现内容与电商的结合。查看源码
  • (自适应响应式)html5蓝色智能水表营销型网站pbootcms模板下载PbootCMS内核开发,为智能水表企业打造的营销型网站解决方案,本模板基于PbootCMS内核开发,为智能水表及相关行业企业设计,采用HTML5+CSS3技术构建,具有响应式布局。查看源码
  • (自适应)重工工业机械挖掘机机推土机网站源码下载基于PbootCMS内核开发的专业级重工机械企业网站模板,适用于挖掘机、推土机等重型工业设备展示。采用响应式设计技术,确保在各类设备上均能呈现专业视觉效果,帮助企业建立数字化展示窗口。查看源码
  • (自适应)品牌策划网络设计作品公司个人pbootcms网站源码下载本款基于PbootCMS开发的网站模板专为品牌策划、设计公司打造,特别适合展示创意作品、设计案例和企业服务。模板采用现代化设计风格查看源码
分享笔记 (共有 篇笔记)
验证码: