111
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

78 lines
2.7 KiB

  1. <?php
  2. /**
  3. * @copyright (C)2016-2099 Hnaoyun Inc.
  4. * @author XingMeng
  5. * @email hnxsh@foxmail.com
  6. * @date 2018年2月14日
  7. * 单内容页控制器
  8. */
  9. namespace app\home\controller;
  10. use app\home\model\ParserModel;
  11. use core\basic\Controller;
  12. class AboutController extends Controller
  13. {
  14. protected $parser;
  15. protected $model;
  16. public function __construct()
  17. {
  18. $this->parser = new ParserController();
  19. $this->model = new ParserModel();
  20. }
  21. // 单页内容
  22. public function index()
  23. {
  24. if (! ! $scode = get('scode', 'vars')) {
  25. // 读取数据
  26. if (! $data = $this->model->getAbout($scode)) {
  27. header('HTTP/1.1 404 Not Found');
  28. header('status: 404 Not Found');
  29. $file_404 = ROOT_PATH . '/404.html';
  30. if (file_exists($file_404)) {
  31. require $file_404;
  32. exit();
  33. } else {
  34. error('您访问的内容不存在,请核对后重试!');
  35. }
  36. } else {
  37. // 如果访问的内容和当前区域不一致,则自动切换
  38. if ($data->acode != cookie('lg')) {
  39. $lgs = $this->config('lgs');
  40. if (isset($lgs[$data->acode])) {
  41. cookie('lg', $data->acode);
  42. }
  43. }
  44. }
  45. // 读取模板
  46. if (! ! $sort = $this->model->getSort($data->scode)) {
  47. if ($sort->contenttpl) {
  48. $content = parent::parser($sort->contenttpl); // 框架标签解析
  49. $content = $this->parser->parserBefore($content); // CMS公共标签前置解析
  50. $content = $this->parser->parserPositionLabel($content, $sort->scode); // CMS当前位置标签解析
  51. $content = $this->parser->parserSortLabel($content, $sort); // CMS分类信息标签解析
  52. $content = $this->parser->parserCurrentContentLabel($content, $sort, $data); // CMS内容标签解析
  53. $content = $this->parser->parserAfter($content); // CMS公共标签后置解析
  54. } else {
  55. error('请到后台设置分类栏目内容页模板!');
  56. }
  57. } else {
  58. error('您访问内容的分类已经不存在,请核对后再试!');
  59. }
  60. } else {
  61. error('您访问的地址有误,必须传递栏目scode参数!');
  62. }
  63. $this->cache($content, true);
  64. }
  65. // 空拦截
  66. public function _empty()
  67. {
  68. error('您访问的地址有误,请核对后重试!');
  69. }
  70. }