<?php
class EmptyAction extends HomeAction{
	
    public function _initialize() {
		parent::_initialize();
		
		$this->modulename=MODULE_NAME;
		$this->_name=$this->modulename;
		$this->assign('modulename',$this->modulename);	
		
    }	
	
	public function _empty($name){
		$re=$_REQUEST;
		if($re){
			foreach($re as $key=>$one){
				$this->assign($key,$one);
			}	
		}
		
		$tpl_name=$this->getdpl($name);
		$this->display($tpl_name);
    }	
	
	public function getdpl($name){
		preg_match('/([a-z]+)([\d]+)/is',$name,$a);
		if(count($a)==3){
			$tpl_name=$a[1];	
		}
		if($tpl_name=='lists'){
			$assname=	"catid";
		}else{
				$assname=	"id";
		}
		$id=$a[2];
		$_GET[$assname]=$id;
		$this->assign($assname,$id);	
		return $tpl_name;
	}
	
    public function index(){
	
		
		$pagedatas=D("page")->where(array('id'=>intval($_REQUEST['id'])))->find();
		$this->assign('pagedatas',$pagedatas);
		$this->display();
    }
	public function show(){
		$this->display();
	}
	
	public function GetCategoryid($pid){
		$arrid[]=$pid;
		$arrid=$this->GetCategoryCid($pid,$arrid);
		return $arrid;
	}
	
	public function GetCategoryCid($cid,&$arrid){
    	$category = D("Category");
        $where = array('model'=>$this->ActionName,'pid'=>$cid);
        $ary_data = $category->where($where)->select();
		if($ary_data){
			foreach($ary_data as $key=>$one){
					$arrid[]=$one['id'];
					$this->GetCategoryCid($one['id'],$arrid);
			}	
		}
		return $arrid;
	}		

}
?>