📄 正在查看:twcms/control/show_control.class.php
大小:1,443 字节 · 修改:2014-01-23 01:42:52 · 行数:49
1<?php
2/**
3 * (C)2012-2014 twcms.com TongWang Inc.
4 * Author: wuzhaohuan <kongphp@gmail.com>
5 */
6
7defined('TWCMS_PATH') or exit;
8
9class show_control extends control{
10 public $_cfg = array(); // 全站参数
11 public $_var = array(); // 内容页参数
12
13 public function index() {
14 // hook show_control_index_before.php
15
16 $_GET['cid'] = (int)R('cid');
17 $_GET['id'] = (int)R('id');
18 $this->_var = $this->category->get_cache($_GET['cid']);
19 empty($this->_var) && core::error404();
20
21 $this->_cfg = $this->runtime->xget();
22
23 // 初始模型表名
24 $this->cms_content->table = 'cms_'.$this->_var['table'];
25
26 // 读取内容
27 $_show = $this->cms_content->read($_GET['id']);
28 if(empty($_show['cid']) || $_show['cid'] != $_GET['cid']) core::error404();
29
30 // SEO 相关
31 $this->_cfg['titles'] = $_show['title'].(empty($_show['seo_title']) ? '' : '/'.$_show['seo_title']);
32 $this->_cfg['seo_keywords'] = empty($_show['seo_keywords']) ? $_show['title'] : $_show['seo_keywords'];
33 $this->_cfg['seo_description'] = empty($_show['seo_description']) ? $_show['intro']: $_show['seo_description'];
34
35 $this->assign('tw', $this->_cfg);
36 $this->assign('tw_var', $this->_var);
37
38 $GLOBALS['run'] = &$this;
39 $GLOBALS['_show'] = &$_show;
40
41 // hook show_control_index_after.php
42
43 $_ENV['_theme'] = &$this->_cfg['theme'];
44 $this->display($this->_var['show_tpl']);
45 }
46
47 // hook show_control_after.php
48}
49