PHP code example of laker-ls / yii2-nested-set-menu
1. Go to this page and download the library: Download laker-ls/yii2-nested-set-menu library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laker-ls / yii2-nested-set-menu example snippets
use lakerLS\nestedSet\Menu;
echo Menu::widget([
'allCategories' => $allCategory,
'beginLvl' => 1,
'options' => [
'main' => [
'ul' => ['class' => 'navbar-nav mr-auto', 'style' => 'margin-top: 20px'],
'lonely' => [
'li' => ['class' => 'nav-item'],
'a' => ['class' => 'nav-link'],
],
'hasNesting' => [
'li' => ['class' => 'nav-item dropdown'],
'a' => ['class' => 'nav-link dropdown-toggle'],
'icon' => 'fa fa-arrow-bottom'
],
'active' => [
'li' => ['class' => 'active'],
'a' => ['class' => 'maybe-necessary-a-instead-of-li',
]
],
'nested' => [
'ul' => ['class' => 'dropdown-menu', 'data-toggle' => 'example'],
'lonely' => [
'li' => ['class' => 'dropdown-item'],
'a' => ['class' => 'dropdown-link'],
],
'hasNesting' => [
'li' => ['class' => 'dropdown-item dropdown'],
'a' => ['class' => 'dropdown-link dropdown'],
'icon' => 'fa fa-arrow-right'
],
'active' => [
'li' => ['class' => 'active'],
'a' => ['class' => 'maybe-necessary-a-instead-of-li',
]
],
],
]);
use lakerLS\nestedSet\Menu;
echo Menu::widget([
'allCategories' => $allCategory,
'options' => [
'main' => [
'ul' => ['class' => 'navbar-nav mr-auto', 'style' => 'margin-top: 20px'],
'lonely' => [
'li' => ['class' => 'nav-item'],
'a' => ['class' => 'nav-link'],
],
'hasNesting' => [
'li' => ['class' => 'nav-item dropdown'],
'a' => ['class' => 'nav-link dropdown-toggle'],
'icon' => 'fa fa-arrow-bottom'
],
'active' => [
'li' => ['class' => 'active'],
]
],
],
]);
$ php composer.phar