<{php}> global $xoopsDB,$xoopsModule; //匯入主選單 $sql = "select name,dirname from ".$xoopsDB->prefix("modules")." where isactive='1' and hasmain='1' and weight!=0 order by weight"; $result = $xoopsDB->query($sql); $option=""; while(list($name,$dirname)=$xoopsDB->fetchRow($result)){ $option.= "\t\t\t
- {$name}
\n"; } echo "
- ".THEME_MODULE0."
  $option
"; $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}>