PHP code example of wtabata / arraymenu

1. Go to this page and download the library: Download wtabata/arraymenu 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/ */

    

wtabata / arraymenu example snippets


$array = [
    'home' => [
        'name' => 'Label for Home',
        'link' => '#',
    ],
    [ /* << see, here don't have key. no matter. just for help u */
        'name' => 'Label for Contact'
    ],
];

$menu = new \Wt\ArrayMenu\Simple($array);
echo $menu;

//set primary Tag 
$menu->setInit(['tag'=>'ol', 'class' =>'my_class']);

//set secondary Tag
$menu_b->setItem(['tag'=>'li', 'class' =>'my_class_for_item other']);

$array = [
    'config' => [ //set primary Tag 
        'tag' => 'ol',
        'class' => 'my_class'
    ],
    'home' => [
        'config' => [ //set secondary Tag
            'tag' => 'dd',
            'class' =>'my_class_for_item other'
        ],
        'name' => 'Label for Home',
        'link' => '#',
    ],
];

$array = [
    'home' => [
        'name' => 'Label for Home',
        'link' => '#',
        'class' => 'nav-link',
    ],
    'contact' => [
        'name' => 'Label for Contact',
        'link' => '#',
        'class' => 'nav-link',
    ],
    'sitemap' => [
        'name' => 'Label for Sitemap',
        'link' => '#',
        'class' => 'nav-link active',
    ]
];

$menu = new \WtArrayMenu\Bootstrap($array, $config_bootstrap = []);
echo $menu;

$config_bootstrap = [
    'position' => 'default',
    'color' => 'bg-primary',
    'container' => 'container',
    'brand' => [
        'name' => 'WT.dev',
        'image' => false,
        'link' => 'https://wtabata.com'
    ],
    'off_canvas' => false
];