public_nav_items — Get the navigation for items.

Navigation-related functions

Summary

public_nav_items($navArray = null, $maxDepth = 0)

Get the navigation for items.

Parameters:
  • $navArray (array) –
  • $maxDepth (integer|null) –
Returns:

string

Usage

Used to display secondary navigation elements within the browse and search pages.

The default value of the $navArray is:

$navArray = array(
        array(
            'label' =>__('Browse All'),
            'uri' => url('items/browse'),
        ));
        if (total_records('Tag')) {
            $navArray[] = array(
                'label' => __('Browse by Tag'),
                'uri' => url('items/tags')
            );
        }
        $navArray[] = array(
            'label' => __('Search Items'),
            'uri' => url('items/search')
        );

This displays the ‘Browse All’, ‘Browse by Tag’, and ‘Search Items’ navigation elements. Plugins such as Geolocation also add navigation elements to this array.

Examples

You can use the public_nav_items function to create a custom browse navigation.

<?php echo public_nav_items(array (
    array (
        'label' => __('Browse All'),
        'uri' => url('items/browse')
        ),
    array (
        'label' => __('Search'),
        'uri' => url('search')
        ),
    array (
        'label' => __('Browse Text Items'),
        'uri' => url('items/browse?type=1')
        )
)); ?>

You can find the item type numbers when viewing the ‘item type’ in the Admin interface. Changing the default array does not affect the navigation elements added by plugins.

See Also