<{php}> global $xoopsDB,$xoopsModule; $sql="select menuid,itemname,itemurl,target,icon from ".$xoopsDB->prefix("tad_themes_menu")." where of_level=0 and status='1' order by position"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error()); while(list($menuid,$itemname,$itemurl,$menu_target,$menu_icon)=$xoopsDB->fetchRow($result)){ $option=""; $sql="select `itemname`,`itemurl`,`target`,`icon` from ".$xoopsDB->prefix("tad_themes_menu")." where of_level='$menuid' and status='1' order by position"; $result2 = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error()); while(list($name,$url,$target,$icon)=$xoopsDB->fetchRow($result2)){ $target=!empty($target)?"target='$target'":""; $icon=empty($icon)?"icon-th-list":$icon; $option.= "\t\t\t
- {$name}
\n"; } $menu_target=!empty($menu_target)?"target='$menu_target'":""; $menu_icon=empty($menu_icon)?"icon-th-list":$menu_icon; if(empty($option)){ echo "
- {$itemname}
"; }else{ echo "
- $itemname
  $option
"; } } <{/php}>