<{php}> global $xoopsDB,$xoopsModule; $modhandler = &xoops_gethandler('module'); $xoopsModule = &$modhandler->getByDirname("tad_themes"); $config_handler = & xoops_gethandler('config'); $xoopsModuleConfig = & $config_handler->getConfigsByCat(0, $xoopsModule->getVar('mid')); if($xoopsModuleConfig['auto_mainmenu']=="1"){ //匯入主選單 $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."
  • "; } $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=get_theme_menu_options($menuid); $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
  • "; } } //取得選單選項 function get_theme_menu_options($id=""){ global $xoopsDB; $sql="select `menuid`,`itemname`,`itemurl`,`target`,`icon` from ".$xoopsDB->prefix("tad_themes_menu")." where of_level='{$id}' and status='1' order by position"; $result = $xoopsDB->query($sql); $option=""; while(list($menuid,$name,$url,$target,$icon)=$xoopsDB->fetchRow($result)){ $target=!empty($target)?"target='$target'":""; $icon=empty($icon)?"icon-th-list":$icon; $option2=get_theme_menu_options($menuid); $submenu_class=($option2)?'class="dropdown-submenu"':''; $dropdown=($option2)?'':''; $tabindex=($option2)?'tabindex="-1"':''; $url=($option2)?'#':$url; $target=($option2)?'':$target; $option.= "\t\t\t
  • {$name}{$dropdown}
  • \n"; } return $option; } <{/php}>