本文整理汇总了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;
}
示例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();
}
示例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'];
?>
示例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;
}