function create_nav_menu($root, &$nest_menu) { global $cat; if (empty($root)) { return; } // 叶节点 if (count($root) == 1 and array_key_exists('id', $root)) { $nest_menu .= '<li><a href="' . SITE_URL . 'category.php?term_id=' . $root['id'] . '" title="">' . $cat->getTermName($root['id']) . "</a></li>\n"; return; } // 父目录 if (count($root) == 2 and array_key_exists('id', $root)) { $nest_menu .= '<li><a href="' . SITE_URL . 'category.php?term_id=' . $root['id'] . '" title="">' . $cat->getTermName($root['id']) . "</a>\n"; $nest_menu .= "<ul>\n"; // 该目录的子目录 create_nav_menu($root['children'], $nest_menu); $nest_menu .= "</ul></li>\n"; return; } foreach ($root as $key => $val) { if (is_numeric($key)) { create_nav_menu($val, $nest_menu); } } }
function widget_navibar() { ?> <div id="navigation" class="clearfix"> <div class="menu-main-container"> <ul class="sf-menu"> <li class="current"><a href="<?php echo SITE_URL; ?> index.php">主页</a> <?php $menu_arr = json_decode(Option_model::getInstance()->getOption('theme_menu'), true); create_nav_menu($menu_arr, $menu); echo $menu; ?> </ul> </div> </div> <?php }
<?php $template->assign('PageTopic', 'Plot A Course'); require_once get_file_loc('menu.inc'); create_nav_menu($template, $player); $container = array(); $container['url'] = 'course_plot_processing.php'; $container['body'] = ''; $template->assign('PlotCourseFormLink', SmrSession::getNewHREF($container)); $container['url'] = 'course_plot_nearest_processing.php'; $template->assign('PlotNearestFormLink', SmrSession::getNewHREF($container)); if ($ship->hasJump()) { $container = create_container('sector_jump_processing.php', ''); $container['target_page'] = 'current_sector.php'; $template->assign('JumpDriveFormLink', SmrSession::getNewHREF($container)); } if (isset($_REQUEST['xtype'])) { SmrSession::updateVar('XType', $_REQUEST['xtype']); } else { if (!isset($var['XType'])) { SmrSession::updateVar('XType', 'Technology'); } } $template->assign('XType', $var['XType']); $template->assign('AllXTypes', array('Technology', 'Ships', 'Weapons', 'Locations', 'Goods')); // get saved destinations $template->assign('StoredDestinations', $player->getStoredDestinations()); $container = create_container('course_destination_button_processing.php'); $container['target_page'] = 'course_plot.php'; $template->assign('ManageDestination', SmrSession::getNewHREF($container));