Skip to content

sleepymustache/module-navigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Navigation

Creates a Navigation UL based on a JSON file. Uses JSON to structure navigation pages and attributes. It can detect what page is active and assign classes to them for special treatment.

Usage

	$topNavData = '{
		"pages": [
			{
				"title": "Nav 1",
				"link": "/nav1/"
			}, {
				"title": "Nav 2",
				"link": "/nav2/",
				"pages": [
					{
						"title": "Subnav 1",
						"link": "/downloads/fpo.pdf",
						"target": "_blank"
					}
				]
			}
		]
	}';

	$topNav = new \Module\Navigation\Builder($topNavData);
	<!-- In body somewhere -->
	<nav class="top">
		<?= $topNav->show(); ?>
	</nav>

Changelog

Version 1.5

  • Added the menu, submenu, and .active.child classes

Version 1.4

  • Now automatically sets $_SERVER['SCRIPT_NAME'] as current page
  • Added multiple hook points for manipulating navigations

Version 1.2

  • Added a track parameter

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages