<?php
defined('PP_PATH') or exit;
class show_control extends base_control{
	public $_var = array();
	public function index() {
		$_GET['cid'] = (int)R('cid');
		$_GET['id'] = (int)R('id');
		$this->_var = $this->category->get_cache($_GET['cid']);
		empty($this->_var) && core::error404();
		$this->cms_content->table = 'cms_'.$this->_var['table'];
		$_show = $this->cms_content->read($_GET['id']);
		if(empty($_show['cid']) || $_show['cid'] != $_GET['cid']) core::error404();
		$this->_cfg['titles'] = $_show['title'].(empty($_show['seo_title']) ? '' : '/'.$_show['seo_title']);
		$this->_cfg['seo_keywords'] = empty($_show['seo_keywords']) ? $_show['title'] : $_show['seo_keywords'];
		$this->_cfg['seo_description'] = $_show['title'].(empty($_show['seo_description']) ? $_show['intro']: $_show['seo_description']);

		$this->assign('pp_var', $this->_var);
		$GLOBALS['run'] = &$this;
		$GLOBALS['_show'] = &$_show;
		$_ENV['_theme'] = &$this->_cfg['theme'];
		$this->display($this->_var['show_tpl']);
	}
}