當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Menu::getChildren方法代碼示例

本文整理匯總了PHP中Menu::getChildren方法的典型用法代碼示例。如果您正苦於以下問題:PHP Menu::getChildren方法的具體用法?PHP Menu::getChildren怎麽用?PHP Menu::getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Menu的用法示例。


在下文中一共展示了Menu::getChildren方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 public function render(Menu $menu)
 {
     $html = '<ul class="nav navbar-nav">';
     foreach ($menu->getChildren() as $menu_elem) {
         $html .= $this->renderElem($menu_elem);
     }
     $html .= '</ul>';
     return $html;
 }
開發者ID:GeorgeAlexandre,項目名稱:OCSInventory-ocsreports,代碼行數:9,代碼來源:MenuRenderer.php

示例2: serialize

 public function serialize(Menu $menu)
 {
     $doc_xml = new DOMDocument('1.0', 'UTF-8');
     $menu_xml = $doc_xml->createElement('menu');
     $doc_xml->appendChild($menu_xml);
     foreach ($menu->getChildren() as $id => $menu_elem) {
         $this->serializeElem($doc_xml, $menu_xml, $id, $menu_elem);
     }
     $doc_xml->preserveWhiteSpace = false;
     $doc_xml->formatOutput = true;
     return $doc_xml->saveXML();
 }
開發者ID:remicollet,項目名稱:OCSInventory-ocsreports,代碼行數:12,代碼來源:XMLMenuSerializer.php

示例3: Menu

<?php

include "../../includes/inc.main.php";
if ($_GET['id']) {
    $MenuID = $_GET['id'];
    $Switcher = new Menu($MenuID);
    $Children = $Switcher->getChildren();
    if (count($Children) < 1) {
        if ($Switcher->MenuData['link'] != "#" && $Switcher->MenuData['link']) {
            header("Location: " . $Switcher->MenuData['link']);
            die;
        }
    }
} else {
    header("Location: ../main/main.php");
    die;
}
$Head->setTitle($Switcher->GetTitle());
$Head->setHead();
include '../../includes/inc.top.php';
?>

  <div class="box box-success">
    <div class="box-body">
      <?php 
foreach ($Children as $Child) {
    ?>
        <div class="col-md-4 col-sm-6">
          <a href="<?php 
    echo $Child['link'];
    ?>
開發者ID:javzero,項目名稱:admin,代碼行數:31,代碼來源:switcher.php

示例4: getNavAsList

 function getNavAsList($page_id = false, $treat_title = false, $title_recurse = true)
 {
     $menu = new Menu();
     if ($page_id == false) {
         $page_id = $menu->getRootNode();
     }
     if (CURRENT_SITE == 'admin') {
         $checkactive = false;
         $checkvisible = false;
     } else {
         $checkactive = true;
         $checkvisible = true;
     }
     $main_nav = $menu->getChildren($page_id, $checkactive, $checkvisible);
     $html = '';
     foreach ($main_nav as $nav) {
         $html .= "<div>";
         if (isset($GLOBALS['page_id']) && $GLOBALS['page_id'] == $nav['id']) {
             $html .= '<b>';
         }
         $html .= Menu::getLink($nav, $treat_title);
         if (isset($GLOBALS['page_id']) && $GLOBALS['page_id'] == $nav['id']) {
             $html .= '</b>';
         }
         $html .= "</div>\n";
         if ($menu->isBranch($nav['id'], $checkactive, $checkactive)) {
             $sub_treat_title = $title_recurse == true ? $treat_title : false;
             $html .= Menu::getChildList($menu, $nav['id'], $sub_treat_title);
         }
     }
     return $html;
 }
開發者ID:nonfiction,項目名稱:nterchange,代碼行數:32,代碼來源:tree.php


注:本文中的Menu::getChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。