1. Go to this page and download the library: Download pavelkucera/navigation 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/ */
use PK\Navigation\Node;
use PK\Navigation\NodeView;
$navigation = new Node('navigation');
$navigation->addChild(new Node('Homepage', 'Homepage:'));
$navigation->addChild(new Node('Blog:', 'Blog:'));
$view = $navigation->render(new NodeView());
$view->label; // 'navigation'
$view->link; // NULL
$view->active; // FALSE
$view->children; // array(2)
use PK\Navigation\Node;
$navigation = new Node();
$navigation->addChild(new Node('Homepage', 'Homepage:'), 1);
$navigation->addChild(new Node('Blog:', 'Blog:'), 5);
use PK\Navigation\Node;
$navigation = new Node();
$navigation->addChild(new Node('Homepage', 'Homepage:'), 1);
$navigation->addChild(new Node('Blog:', 'Blog:'), 5);
$navigation->resolveActive(function($link) {
return $presenter->isLinkCurrent($link);
});
$navigation->resolveActive($callback, TRUE);
use PK\Navigation\NodeView;
$navigation->renderActiveNodes(new NodeView());
use PK\Navigation\Node;
use PK\Navigation\NodeView;
$roleRestricted = new Node('the Jedi Temple', 'Entrance:');
$roleRestriected->restrictAccess('jedi'); // only jedi can access the jedi temple
$roleRestriected->render(new NodeView(), function($role) {
return $role === 'jedi';
});
$permissionsRestricted = new Node('Abydos', 'Stargate:abydos');
$permissionsRestricted->restrictPermissions('startgate', 'access'); // only people with access to a stargate can travel to Abydos
$permissionsRestricted->render(new NodeView(), function($resource, $privilege) {
return $resource === 'stargate' && $privilege === 'access';
});
TRUE
TRUE
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.