本文整理汇总了PHP中Menu::addChild方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::addChild方法的具体用法?PHP Menu::addChild怎么用?PHP Menu::addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::addChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: menu
public static function menu()
{
\Menu::add(['index' => 0, 'icon-class' => 'fa fa-dashboard', 'name' => 'dashboard', 'label' => trans('backend/dashboard.dashboard'), 'url' => url('backend/c/dashboard')]);
\Menu::add(['index' => 10, 'icon-class' => 'fa fa-cube', 'name' => 'article', 'label' => trans('backend/article.articles')]);
\Menu::addChild(['index' => 10, 'group' => true, 'target' => 'article', 'name' => 'navigation', 'label' => trans('backend/general.navigation')]);
\Menu::addChild(['index' => 10, 'target' => 'article', 'target_group' => 'navigation', 'label' => trans('backend/general.show_all'), 'url' => url('backend/c/article')]);
\Menu::addChild(['index' => 20, 'target' => 'article', 'target_group' => 'navigation', 'label' => trans('backend/article.add'), 'url' => url('backend/c/article/a/add')]);
}
示例2: Menu
* @author Francisco Yure Pereira de Araujo <franciscoyurep@gmail.com>
* @since 2014-04-21
*
*/
require_once 'IComponentMenu.class.php';
require_once 'Menu.class.php';
require_once 'SubMenu.class.php';
require_once 'Item.class.php';
$menu = new Menu();
$subMenu = new SubMenu();
$subMenu2 = new SubMenu();
$item1 = new Item('#link-item1', 'Item 1');
$item2 = new Item('#link-item2', 'Item 2');
$item3 = new Item('#link-item3', 'Item 3');
$item4 = new Item('#link-item4', 'Item 4');
$menu->addChild($item1);
$menu->addChild($item2);
$menu->addChild($item3);
$menu->addChild($item4);
$subMenu2->addChild($item1);
$subMenu2->addChild($item2);
$subMenu2->addChild($item3);
$subMenu2->addChild($item4);
$subMenu->addChild($item1);
$subMenu->addChild($item2);
$subMenu->addChild($subMenu2);
$subMenu->addChild($item3);
$menu->addChild($subMenu);
?>
<!doctype html>
<html lang="en">
示例3: addChild
public static function addChild($data, SimpleXMLElement $xml)
{
foreach ($data as $tagName => $tagValue) {
if (is_numeric($tagName)) {
Menu::addChild($tagValue, $xml);
continue;
}
if (!is_array($tagValue)) {
$child = $xml->addChild($tagName, (string) $tagValue);
continue;
}
foreach ($tagValue as $key => $value) {
$child = $xml->addChild($tagName);
// Do we need this?
if (!is_array($value)) {
$child->addAttribute($key, (string) $value);
continue;
}
foreach ($value as $k => $v) {
if (is_array($v)) {
Menu::addChild(array($k => $v), $child);
} else {
$child->addAttribute($k, (string) $v);
}
}
}
}
/* this is the recently working code
if (isset($data[$this->_menuTag])) {
foreach ($data[$this->_menuTag] as $key => $value) {
$child = $xml->addChild($this->_menuTag);
foreach ($value as $k => $v) {
if ($k == $this->_menuTag) {
Menu::addChild(array($k => $v), $child);
} else {
$child->addAttribute($k, (string)$v);
}
}
}
}
*/
}