~channelname~
\r\n
\r\n\r\n"; $itemTemplet = "
  • ~link~
  • \r\n"; function GetMenus($userrank,$topos='main') { global $openitem,$headTemplet,$footTemplet,$itemTemplet; if($topos=='main') { $openitem = (empty($openitem) ? 1 : $openitem); $menus = $GLOBALS['menusMain']; } else if($topos=='module') { $openitem = 100; $menus = $GLOBALS['menusMoudle']; } $dtp = new DedeTagParse(); $dtp->SetNameSpace('m','<','>'); $dtp->LoadSource($menus); $dtp2 = new DedeTagParse(); $dtp2->SetNameSpace('m','<','>'); $m = 0; foreach($dtp->CTags as $i=>$ctag) { if($ctag->GetName()=='top' && ($ctag->GetAtt('rank')=='' || TestPurview($ctag->GetAtt('rank')) )) { if($openitem!=999 && !preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) && $openitem!=100) continue; $m++; echo "\r\n"; $htmp = str_replace("~channelname~",$ctag->GetAtt("name"),$headTemplet); if(empty($openitem) || $openitem==100) { if($ctag->GetAtt('notshowall')=='1') continue; $htmp = str_replace('~display~',$ctag->GetAtt('display'),$htmp); } else { if($openitem==$ctag->GetAtt('item') || preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) || $openitem=='-1') $htmp = str_replace('~display~','block',$htmp); else $htmp = str_replace('~display~','none',$htmp); } $htmp = str_replace('~cc~',$m.'_'.$openitem,$htmp); echo $htmp; $dtp2->LoadSource($ctag->InnerText); foreach($dtp2->CTags as $j=>$ctag2) { $ischannel = trim($ctag2->GetAtt('ischannel')); if($ctag2->GetName()=='item' && ($ctag2->GetAtt('rank')=='' || TestPurview($ctag2->GetAtt('rank')) ) ) { $link = "".$ctag2->GetAtt('name').""; if($ischannel=='1') { if($ctag2->GetAtt('addalt')!='') { $addalt = $ctag2->GetAtt('addalt'); } else { $addalt = '录入新内容'; } if($ctag2->GetAtt('addico')!='') { $addico = $ctag2->GetAtt('addico'); } else { $addico = 'images/gtk-sadd.png'; } //an add icos , small items use att ischannel='1' addico='ico' addalt='msg' linkadd='' $link = "
    $link
    \r\n
    $addalt
    \r\n"; } else { $link .= "\r\n"; } $itemtmp = str_replace('~link~',$link,$itemTemplet); echo $itemtmp; } } echo $footTemplet; echo "\r\n"; } } } //End Function