2017 © Pedro Peláez
 

library navigation

Navigation component for Nette Framework.

image

inteve/navigation

Navigation component for Nette Framework.

  • Sunday, June 24, 2018
  • by janpecha
  • Repository
  • 1 Watchers
  • 0 Stars
  • 197 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 15 % Grown

The README.md

Inteve\Navigation

Build Status Downloads this Month Latest Stable Version License, (*1)

Navigation component for Nette Framework., (*2)

Donate, (*3)

Installation

Download a latest package or use Composer:, (*4)

composer require inteve/navigation

Inteve\Navigation requires PHP 7.4 or later and Nette 2.2+ or 3.0+., (*5)

Usage

Define pages

``` php <?php, (*6)

use Inteve\Navigation\Navigation;, (*7)

$navigation = new Navigation; $navigation->addPage('/', 'Homepage'); $navigation->addPage('contact', 'Contact'); $navigation->addPage('news', 'News'); $navigation->addPage('news/2016', 'News 2016'); $navigation->addPage('news/2015', 'News 2015');, (*8)

$navigation->setDefaultPage('/'); $navigation->setCurrentPage('news/2016'); $navigation->isPageCurrent('news/2016'); // returns bool $navigation->isPageActive('news'); // returns bool, (*9)


### Breadcrumbs ``` php <?php $navigation->addItem('Detail'); $navigation->addItemBefore('/', 'My Website', ':Homepage:default'); $navigation->addItemAfter('news/2016', 'Page 1', ':News:default', array('page' => 1)); $breadcrumbs = $navigation->getBreadcrumbs();

Render menu

``` php <?php, (*10)

use Inteve\Navigation\Navigation; use Inteve\Navigation\MenuControl;, (*11)

class NewsPresenter extends Nette\Application\UI\Presenter { /** @var Navigation @inject */ public $navigation;, (*12)

protected function createComponentNewsMenu()
{
    // render items 'News 2016' & 'News 2015'
    $menu = new MenuControl($this->navigation);
    $menu->setSubTree('news');
    return $menu;
}


protected function createComponentSubMenu()
{
    // Renders submenu by current page
    // for setCurrentPage('news') or setCurrentPage('news/any/thing') it renders items 'news/2016' & 'news/2015'
    // for setCurrentPage('contact') it renders nothing
    $menu = new MenuControl($this->navigation);
    $menu->setSubTree('/');
    $menu->setSubLevel(1);
    return $menu;
}

}, (*13)


In Latte template: ```latte {control newsMenu}

Render breadcrumbs

``` php <?php, (*14)

use Inteve\Navigation\Navigation; use Inteve\Navigation\BreadcrumbsControl;, (*15)

class Presenter extends Nette\Application\UI\Presenter { /** @var Navigation @inject */ public $navigation;, (*16)

protected function createComponentBreadcrumbs()
{
    return new BreadcrumbsControl($this->navigation);
}

}, (*17)


In Latte template: ```latte {control breadcrumbs}

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/, (*18)

The Versions

24/06 2018

dev-master

9999999-dev

Navigation component for Nette Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

24/06 2018

v1.2.0

1.2.0.0

Navigation component for Nette Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

11/01 2018

v1.1.1

1.1.1.0

Navigation component for Nette Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

11/01 2018

v1.1.0

1.1.0.0

Navigation component for Nette Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

03/01 2017

v1.0.1

1.0.1.0

Navigation component for Nette Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

21/08 2016

v1.0.0

1.0.0.0

Navigation component for Nette Framework.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires