Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inteve/navigation
Navigation component for Nette and more
https://github.com/inteve/navigation
breadcrumbs navigation nette php
Last synced: 3 months ago
JSON representation
Navigation component for Nette and more
- Host: GitHub
- URL: https://github.com/inteve/navigation
- Owner: inteve
- License: other
- Created: 2016-07-27T10:43:13.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-14T12:31:49.000Z (8 months ago)
- Last Synced: 2024-09-29T22:42:50.607Z (3 months ago)
- Topics: breadcrumbs, navigation, nette, php
- Language: PHP
- Homepage:
- Size: 76.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license.md
Awesome Lists containing this project
README
# Inteve\Navigation
[![Build Status](https://github.com/inteve/navigation/workflows/Build/badge.svg)](https://github.com/inteve/navigation/actions)
[![Downloads this Month](https://img.shields.io/packagist/dm/inteve/navigation.svg)](https://packagist.org/packages/inteve/navigation)
[![Latest Stable Version](https://poser.pugx.org/inteve/navigation/v/stable)](https://github.com/inteve/navigation/releases)
[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/inteve/navigation/blob/master/license.md)Navigation component for Nette Framework.
## Installation
[Download a latest package](https://github.com/inteve/navigation/releases) or use [Composer](http://getcomposer.org/):
```
composer require inteve/navigation
````Inteve\Navigation` requires PHP 7.4 or later and Nette 2.2+ or 3.0+.
## Usage
### Define pages
``` php
addPage('/', 'Homepage');
$navigation->addPage('contact', 'Contact');
$navigation->addPage('news', 'News');
$navigation->addPage('news/2016', 'News 2016');
$navigation->addPage('news/2015', 'News 2015');$navigation->setDefaultPage('/');
$navigation->setCurrentPage('news/2016');
$navigation->isPageCurrent('news/2016'); // returns bool
$navigation->isPageActive('news'); // returns bool
```### Breadcrumbs
``` php
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
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;
}
}
```In Latte template:
```latte
{control newsMenu}
```### Render breadcrumbs
``` php
navigation);
}
}
```In Latte template:
```latte
{control breadcrumbs}
```------------------------------
License: [New BSD License](license.md)
Author: Jan Pecha, https://www.janpecha.cz/