<?php
if(!defined('IN_DEMOSOSO')) {
	exit('this is wrong page,please back to homepage');
}
?>
<ul>
<?php
$sqlmenu = "SELECT * from ".TABLE_MENU." where pid='$main_menuid'  and ppid='$pidmenu' and sta_visible='y' $andlangbh order by pos desc,id";
 // echo $sqlmenu;
//echo getnum($sqlmenu);
if(getnum($sqlmenu)>0){
	 
	$menulist = getall($sqlmenu);
	//pre($menulist);
		foreach($menulist as $v){
	$pidname=$v['pidname'];
	$linkurl=$v['linkurl'];
	$menu_xiala=$v['menu_xiala'];
	$type=$v['type'];
	$typefour=substr($type,0,4);
	$name=decode($v['name']);
	$active= '';
 if($typefour=='page'){

 		 $subpagearr = get_fieldarr(TABLE_PAGE,$type,'pidname');
             if($subpagearr=='no')  $name='单页面不存在';
                else {
                   $name=decode($subpagearr['name']);
                   $tid=$subpagearr['id'];  
			 		 $linkurl = get_url($subpagearr);
                }
								//-------------------
								 if($curpidname==$type) $active=' active"';
 }
 else{
 	  if(@$cateofpagemenu==$pidname) $active=' active';
   }

  echo '<li class="m"><a class="m'.$active.'" '.linkhref($linkurl).'>'.$name.'</a></li>';
			 //---------------------
       }//end foreach

	} //if(getnum($sqlmenu)>0)
	else echo '<li class="m"><a class="m" href="'.$mainurl.'">'.decode($maintitle).'</a></li>';

?>
</ul>