PHP_Framework

Wh1t3projects' PHP framework. Small PHP framework for building web apps and websites

View the Project on GitHub

Syntax: theme_navbar_dropdown(string $text, array $itemsArray [, string $elementID])

Render a navigation dropdown item meant to be used in a navigation bar (usually in the header of the page).


Parameters

$text
The text of the dropdown to display

$itemsArray
An associative array of items to be displayed inside the dropdown.
Each elements of the array consist of the key being used for the display text and the value for the link, just like this: 'SomeText' => 'http//example.org'.

Optional $elementID
The HTML ID and name of the dropdown.


Return values

The HTML code for rendering a dropdown inside a navigation bar with the specified text, items array and ID.


Examples:

Print a dropdown with the text Welcome! and two items. The first display Hello world! with a link to the example.org website and the second display Home with a link to to the root of the website

echo theme_navbar_dropdown('Welcome!', array(
    'Hello world' => 'http://example.org',
    'Home' => '/'
));


Print a Documentation dropdown with a few helpful links

echo theme_navbar_dropdown('Documentation', array(
    'Home' => '#',
    'Getting started' => '#',
    'Modules' => '#',
    'Themes' => '#'
));

NOTE: You can see this example in context in the header.php file.