<?php 
if(!defined('IN_DEMOSOSO')) {
	exit('this is wrong page,please back to homepage');
}

$res = array(); 
$cate = $v;
$catename = get_field(TABLE_CATE,'name',$cate,'pidname'); 
if(substr($cate,0,4)=='cate') $pid = $cate;
else{
    if(havesub(TABLE_CATE,'pid',$cate)) {
         $pid=$cate;
	}
	else {
         $pid = get_field(TABLE_CATE,'pid',$cate,'pidname');
	}
}

 
//begin cate level 1
$sql = "SELECT ppid,name,pidname from ".TABLE_CATE." where pid='$pid'  and sta_visible='y' $andlangbh order by pos desc,id";
//echo $sql;	
 //echo getnum($sql);
if(getnum($sql)>0){
		$result = getall($sql);
		 
		  pre($result);
	 
		 $res['title'] = $catename;		 
		 $res['data'] = $result;
		if($test=='y')  pre($res);
		 $jsonv = json_encode($res,JSON_UNESCAPED_UNICODE);
				//echo $jsonv;
		 echo api_jsonp_encode($jsonv); 
}//end 	if(getnum($sql)>0)
else {
	echo 'no data';
}
  
 

		
?>