CustomViewController.class.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Home\Controller;
  3. /**
  4. * 自定义页面
  5. * @author Devil
  6. * @blog http://gong.gg/
  7. * @version 0.0.1
  8. * @datetime 2016-12-01T21:51:08+0800
  9. */
  10. class CustomViewController extends CommonController
  11. {
  12. /**
  13. * [_initialize 前置操作-继承公共前置方法]
  14. * @author Devil
  15. * @blog http://gong.gg/
  16. * @version 0.0.1
  17. * @datetime 2016-12-03T12:39:08+0800
  18. */
  19. public function _initialize()
  20. {
  21. // 调用父类前置方法
  22. parent::_initialize();
  23. }
  24. /**
  25. * [Index 文章详情]
  26. * @author Devil
  27. * @blog http://gong.gg/
  28. * @version 0.0.1
  29. * @datetime 2016-12-06T21:31:53+0800
  30. */
  31. public function Index()
  32. {
  33. $m = M('CustomView');
  34. $field = array('id', 'title', 'content', 'is_header', 'is_footer', 'is_full_screen', 'access_count');
  35. $data = $m->field($field)->where(array('id'=>I('id'), 'is_enable'=>1))->find();
  36. if(!empty($data['content']))
  37. {
  38. // 访问统计
  39. $m->where(array('id'=>I('id')))->setInc('access_count');
  40. // 静态资源地址处理
  41. $data['content'] = ContentStaticReplace($data['content'], 'get');
  42. $this->assign('is_header', $data['is_header']);
  43. $this->assign('is_footer', $data['is_footer']);
  44. $this->assign('data', $data);
  45. $this->display('Index');
  46. } else {
  47. $this->assign('msg', L('customview_on_exist_error'));
  48. $this->display('/Public/TipsError');
  49. }
  50. }
  51. }
  52. ?>