-
厨房厨具类网站pbootcms模...
-
不锈钢金属门类网站pb...
-
装修地暖管材类网站pb...
-
车牌识别系统类网站pb...
-
电子产品类网站pbootcms模...
-
运动健身类网站pbootcms模...
-
广告策划类网站pbootcms模...
-
国际教育出国留学类网站...
-
沙盘模型制作类网站pb...
-
蔬菜水果配送类网站pb...
-
企业产品展示类网站pb...
-
活动隔断装修装饰类网站...
-
建筑资质办理类网站pb...
-
新闻资讯网站教程类网站...
-
APP应用程序官网类网站...
-
注塑加工类网站pbootcms模...
-
中英双语卫浴阀门类网站...
-
矿山矿石设备类网站pb...
-
粮食米业类网站pbootcms模...
-
大理石瓷砖生产类网站...
打开\apps\home\controller\SearchController.php文件,把里面的代码全部替换成以下(分为2x和3x版本,对应版本替换):
pbootcms2.1.1版本替换
pbootcms3.0.3版本替换<?php
/**
* @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();
}
}
}
效果图<?php
/**
* @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();
}
}
}