12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
-
- 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()
- {
- $searchtpl = request('searchtpl');
- if (! preg_match('/^[\w]+\.html$/', $searchtpl)) {
- $searchtpl = 'search.html';
- }
-
- $content = parent::parser($this->htmldir . $searchtpl);
- $content = $this->parser->parserBefore($content);
- $pagetitle = get('keyword', 'var') ? get('keyword', 'var') . '-' : '';
- $content = str_replace('{pboot:pagetitle}', $this->config('search_title') ?: $pagetitle . '搜索结果-{pboot:sitetitle}-{pboot:sitesubtitle}', $content);
- $content = $this->parser->parserPositionLabel($content, 0, '搜索', Url::home('search'));
- $content = $this->parser->parserSpecialPageSortLabel($content, - 1, '搜索结果', Url::home('search'));
- $content = $this->parser->parserSearchLabel($content);
- $content = $this->parser->parserAfter($content);
- echo $content;
- exit();
- }
- }
|