Navigation Build

Navigation Builds are composed of the following parts held within an array:

Build Key Descriptions
startWrap Begins the element block of the navigation.
beforeLink HTML placed before the title of a link. Also uses [[URL]] as a place holder which is switch out with the actual link.
afterLink HTML placed after the title of a link.
startSubWrap HTML placed before the title of a parent link that is followed by the beginning of a sub-navigation.
midSubWrap HTML placed after the title of a parent link and before the beginning of a sub-navigation.
  Between midSubWrap and endSubWrap, the beforeLink and afterLink are repeated for the sub-navigation.
endSubWrap HTML placed after the sub-navigation.
endWrap Ends the element block of the navigation.
SelectedClass CSS class that is added when a link is selected.
SelectedSubClass CSS class that is added when a sub-link is selected.

 

The following is an example of how the Navigation Build would dynamically populate within the HTML:

Navigation Build Setup

<?php
$TopNavBuild = array(
 'startWrap' => '<ul>',
 'beforeLink' => '<li><a href="[[URL]]">',
 'afterLink' => '</a></li>',
 'startSubWrap' => '<li><a href="[[URL]]">',
 'midSubWrap' => '</a><ul>',
 'endSubWrap' => '</ul></li>',
 'endWrap' => '</ul>'
 'SelectedClass' => 'Selected',
 'SelectedSubClass' => 'Selected'
);
?>

Navigation Build Displayed

<html>
<ul> <!-- startWrap -->
<li><a href="#">Home</a></li> <!-- beforeLink & afterLink -->
<li><a class="Selected" href="#">News</a></li> <!-- Assuming News was the current page -->
<li><a href="#">Partners</a> <!-- startSubWrap & midSubWrap -->
<ul>
<li><a href="#">Company</a></li> <!-- beforeLink & afterLink -->
</ul> <!-- endSubWrap -->
</li>
<li><a href="#">Contact Us</a></li> <!-- beforeLink & afterLink -->
</ul> <!-- endWrap -->
</html>

Registering Your Navigation Build

For your navigation to be provided as an available slot within the Menus' page of the Admin Console, you must have it registered so the CMS can read it.

The following example is how you would register the build shown above as a named slot called "Top Navigation":

<?php register_menu('Top Navigation',$TopNavBuild);?>

**NOTE** - The variable "$TopNavBuild" carrying the array can be renamed to anything you would like it to be.

Continue to Get Calls.