2017 © Pedro Peláez
 

library simplenavigation

Simple HTML navigation generator.

image

jvs/simplenavigation

Simple HTML navigation generator.

  • Monday, September 9, 2013
  • by jahvi
  • Repository
  • 2 Watchers
  • 1 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Simple Navigation for PHP

Build Status, (*1)

Super simple class for rendering navigation from an array of items., (*2)

Installation

With Composer

Simply require the library on your composer.json file:, (*3)

"require": {
    "jvs/simplenavigation": "dev-master"
}

And run composer install or composer update if you already installed some packages., (*4)

Without Composer

  1. Download the zip file
  2. Extract to your project folder
  3. Make sure to require the main class require_once 'lib/JVS/SimpleNavigation.php';

Usage

SimpleNavigation provides a simple make function that expects an array with the menu items you want to render, it can be a simple array:, (*5)

$simpleNav = new JVS\SimpleNavigation;
$navItems = array('Home', 'About Us', 'Blog');

echo $simpleNav->make($navItems);

Which outputs:, (*6)

<ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About Us</a></li>
    <li><a href="#">Blog</a></li>
</ul>

A multi-dimensional array with key/value pairs representing the label and url of the item:, (*7)

$simpleNav = new JVS\SimpleNavigation;
$navItems = array(
    'Home'     => 'http://www.example.com/',
    'About Us' => 'http://www.example.com/about.php',
    'Blog'     => 'http://www.example.com/blog.php',
);

echo $simpleNav->make($navItems);

Which outputs:, (*8)

<ul>
    <li><a href="http://www.example.com/">Home</a></li>
    <li><a href="http://www.example.com/about.php">About Us</a></li>
    <li><a href="http://www.example.com/blog.php">Blog</a></li>
</ul>

Or a fully nested array of arrays:, (*9)

$simpleNav = new JVS\SimpleNavigation;
$navItems = array(
    'Home'     => 'http://www.example.com/',
    'About Us' => array(
        'Our Company' => 'http://www.example.com/about/company.php',
        'Our Team'    => 'http://www.example.com/about/team.php',
    ),
    'Blog'     => 'http://www.example.com/blog.php',
);

echo $simpleNav->make($navItems);

Which outputs:, (*10)

<ul>
    <li><a href="http://www.example.com/">Home</a></li>
    <li>
        <a href="http://www.example.com/about.php">About Us</a>
        <ul>
            <li><a href="http://www.example.com/about/company.php"></a></li>
            <li><a href="http://www.example.com/about/team.php"></a></li>
        </ul>  
    </li>
    <li><a href="http://www.example.com/blog.php">Blog</a></li>
</ul>

That's all there is to it for now., (*11)

Contributing

Feel free to submit bugs or pull requests, just make sure to include unit tests if relevant., (*12)

The Versions

09/09 2013

dev-master

9999999-dev

Simple HTML navigation generator.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

html navigation menu

08/09 2013

1.0.0

1.0.0.0

Simple HTML navigation generator.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

html navigation menu