PHP code example of anekdotes / menus

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

    

anekdotes / menus example snippets


  use Anekdotes\Menus\Menus;

  Menus::addItem('test 1', '/test1', 'fa-potato');

  Menus::addItem('test 1', '/test1', 'fa-potato', 1, 1);

  Menus::addItem('test 1', '/test1', 'fa-potato', 1, 1, 'potato');

  $items = Menus::main();

  $items = Menus::get('potato', 1);

  Menus::addItem($title, $url, $icon, $level, $position, $namespace);
  //$title the link title/name/text
  //$url the link url
  //$icon the link icon (font-awesome, ex: fa-times)
  //$level the link level (default: 1)
  //$position the link position (default: 0)
  //$namespace the link namespace (default: "")

  Menus::removeItem($level, $position);
  //$level link level
  //$position the link position

  Menus::find($level, $position);
  //$level link level
  //$position the link position

  Menus::main($sort);
  //$sort sorting either SORT_ASC or SORT_DESC (default: SORT_ASC)

  Menus::clear();

  Menus::get($namespace, $level);
  //$namespace the link namespace (default: "")
  //$level the link level (default: 1)