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

 ?>
	<?php
	global $sidebar;
	
	if($sidebar<>'hide'){
 
		 $numhere = 1;

			 if($curcate_pid=='0') $curid_sdhere  =  $mainpidname;
			 elseif(substr($curcate_pid,0,4)=='cate') {
			 	
			 		if(havesub(TABLE_CATE,'pid',$curcatepidname)) {
			 			$numhere = 0;
			 			$curid_sdhere  =  $curcatepidname;
			 		}
			 		else $curid_sdhere  =  $mainpidname;

			 }
			 	else {
			 		//////echo '33333';
			 		$numhere = 0;
			 		$curid_sdhere  =  $curcate_pid;
			 	}

			 	//echo $curid_sdhere;
		// $curid =  havesub(TABLE_CATE,'pid',$curcatepidname)?$curcatepidname:$mainpidname;
					// if(havesub(TABLE_CATE,'pid',$curcatepidname)){

			 $sql = "SELECT id from ".TABLE_CATE." where  pid='$curid_sdhere' and  sta_visible='y' $andlangbh order by id desc";
			// echo '<br />'.$sql;

			 
			 
         if(getnum($sql)>$numhere) {

					 		echo '<div class="sdcontent sidermenutop">';

							 $curid  = $curcatepidname;
							  

							 $rescate = getarr_cate($curid_sdhere);
							// pre($rescate);
							foreach ($rescate['data'] as $v) {
								//pre($v);
								$classv = ($v['pidname'] == $curcatepidname )?' class= "active" ':'';

								//curcatepidname
								 echo '<li><a '.$classv.' href="'.$v['link'].'">'.$v['name'].'</a></li>';
							}

	  					echo '</div>';
					}
					//else{
						// echo 2222222222;
						//$pidhere = get_field(TABLE_CATE,'pid',$curcatepidname,'pidname');
						//if(substr($pidhere, 0,4)=='cate') $curid = $mainpidname;
						//else $curid = $pidhere;


					//}
					// echo 'aaaa'.$curid;
					
			 
	}   

	 