<?php
if (!defined('IN_59MIAO'))
{
	exit('Access Defined');
}
class ItemAction extends Action{
	private $cid;
	private $sid;	
	private $iid;
	private $item;  //保存商品信息
	private $_keywords=''; //关键字信息
	public function __construct(){
		parent::__construct();	
		$this->iid = isset($_GET['iid'])?$_GET['iid']:null;
		if(!$this->iid)
		{
			Header("Location: index.php");
			exit;
		}		
		$this->_nav = new NavModel();	
		$this->_keywords=new KeywordsModel();
	}
	public function index(){
		if (!$this->_tpl->is_cached(SMARTY_FRONT.'/item.tpl',$_SERVER["REQUEST_URI"])) {			
			$AllNav=$this->_nav->findAllFront();
			$this->_tpl->assign('AllNav',$AllNav['allnav']);
			$this->item=$this->_model->getItemsDetail();
			$item=$this->item;		
			$this->_tpl->assign('taoitem',$item['item']);
			$AllKeywords=$this->_keywords->findAllFront();
			$this->_tpl->assign('KeyWords',$AllKeywords);		
			$right_item=$this->GetRightItem($item['item']['cid'],30);				
		}
		$this->_tpl->display(SMARTY_FRONT.'/item.tpl',$_SERVER["REQUEST_URI"]);
	
	}		
	//获取相关内容
	private function GetRightItem($cid,$page_size){			
			$right_items = $this->_model->GetRightItem($cid,$page_size);			
			$this->_tpl->assign('right_items',$right_items);
	}	
}
?>