Functions/public nav

< Functions(Redirected from Theme API/public nav)

Provides an unordered list of links for site navigation.

To get the navigation element that plugins will add to by default, use public_nav_main.

Usage

<?php public_nav($navArray, $navType) ?>

Arguments

  • array $navArray: An array of link labels pointing to link URLs. Best practice for creating links to other parts of an Omeka site is to use the uri() helper.
  • string $navType: (optional) A name specifying what "type" of navigation is being created. Omitting this argument causes plugins to be unable to add to the navigation.

Example

The following example code will print only exactly the links that are passed in the $navArray. Plugins will not add any additional links.

<ul>
<?php 
echo public_nav(
    array(
        'Browse Items' => uri('items'), 
        'Browse Collections' => uri('collections')
    )
);
?>
</ul>

This example will generate the following HTML:

<ul>
<li><a href="http://example.com/items">Browse Items</a></li>
<li><a href="http://example.com/collections">Browse Collections</a></li>
</ul>

On the other hand, public_nav can also be used to create a new navigation "type" that plugins can optionally attach to.

<?php 
echo public_nav(
    array(
        'Browse Items' => uri('items'), 
        'Browse Collections' => uri('collections')
    ), 'mynav'
);
?>

In the above case, plugins will be able to use a filter called 'public_navigation_mynav' to add to this element without affecting the main or any other navigation.

CSS Styles

The default CSS style div class tag is .navigation.

Source File/Version

  • application/helpers/LinkFunctions.php since Omeka 1.0