定制 adamb/menu-builder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

adamb/menu-builder

Composer 安装命令:

composer require adamb/menu-builder

包简介

Build a HTML navigation

README 文档

README

Create a HTML menu and breadcrumb menu items from a PHP array

Installation

Installation is available via Composer/Packagist:

composer require adamb/menu-builder

License

This software is distributed under the MIT license. Please read LICENSE for information on the software availability and distribution.

Basic Usage

Add Menu Items

Make a new instance of the Navigation menu builder

<?php
$navigation = new Menu\Navigation();

Add some menu items

// Add links individually
$navigation->addLink('Home', '/', array('link_order' => -1000));
$navigation->addLink('About Me', '/about-me', array('link_order' => 2));

// Add an array of links
$navArray = [
    [
        'title' => 'My Link',
        'uri' => '/my-link-page',
        'link_order' => 3
    ],
    [
        'title' => 'Has Children',
        'uri' => '/child/',
        'link_order' => 4
        'children' => [
            [
                'title' => 'Second Child',
                'uri' => '/child/second',
                'link_order' => 2
            ],
            [
                'title' => 'First Child',
                'uri' => '/child/first',
                'link_order' => 1
            ],
            [
                'title' => 'Last Child',
                'uri' => '/child/last',
                'link_order' => 3
            ],
        ]
    ]
];

$navigation->addLinks($navArray);

The addLink method allows the following:

$navigation->addLink($title, $uri [, $options = []]);
  • $title Is a string that should contain the test to display on the link
  • $uri Is a string that should contain the link URI
  • $options Is an array that can contain any of the following array elements ['label', 'uri', 'fragment', 'title', 'target', 'rel', 'class', 'id', 'link_order', 'active', 'li_class', 'li_id', 'ul_class', 'ul_id', 'children']

Set Current URI

Set the active link for the menu

 $navigation->setCurrentURI('/about-me'); // Makes the about me page the current select item in the menu

Render Menu

Output the menu to the screen

echo($navigation->render());

Render Breadcrumb Menu

Output a breadcrumb menu to the screen

echo($navigation->renderBreadcrumb());

统计信息

  • 总下载量: 196
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固