Saturday, May 19, 2012

Return Home
Contact Me

Soholaunch getNav() / showNav()

Description

Creates an HTML unordered list of menu items set in the Menu Navigation tab of the Soholaunch back-end.

Usage


<?php $navigation = $mytemplate->getNav($args); ?>

or


<?php $mytemplate->showNav($args); ?>

Parameters

Accepts an associative array with the follow ID keys and values:

  • type: String – Must be one of the following:

    • full (default value) – Full navigation with nested unordered lists of sub-pages.
    • main – Main navigation of main page items (like #VMAINS# or #HMAINS#).
    • sub – Sub navigation that is only diplayed if a page has sub-pages or has sibling sub-pages (like #VSUBS# or #HSUBS#).
  • has_container: Boolean – wrap the output in a HTML div tag (true by default).
  • container_id: String – assign a value to the ID attribute of the div container.
  • container_class: String – assign a value to the class attribute of the div container.
  • menu_id: String – assign a value to the ID attribute of the navigation ul.
  • menu_class: String – assign a value to the class attribute of the navigation ul.
  • before_link_tag: String – text to be displayed outside the anchor tag, before it.
  • after_link_tag: String – text to be displayed outside the anchor tag, after it.
  • before_link_text: String – text to be displayed inside the anchor tag, before it.
  • after_link_text: String – text to be displayed inside the anchor tag, after it.
  • list_items_before: String or Array – the string or each array item will be placed in a list item tag before the nav list items.
  • list_items_after: String or Array – the string or each array item will be placed in a list item tag after the nav list items.
  • display_title: Boolean – Display page titles instead of page names (false by default). Function will default to page name if page title has not been set.

Return Value

If using getNav(), a string is returned with the HTML of the navigation menu.

Example


<?php
$mytemplate->showNav(array(
	'type' => 'full',
	'container_id' => 'footer',
	'menu_class' => 'menu',
	'list_items_before' => array('<a href="http://google.com/" title="Google" target="_blank">Google</a>','<a href="http://yahoo.com/" title="Yahoo!" target="_blank">Yahoo!</a>'),
	'list_items_after' => '<span class="novariant">#COPYRIGHT#</span>'
));
?>

Would echo HTML similar to this (depending on your navigation page values and copyright text values set in webmaster settings).


<div id="footer">
<ul class="menu">
  <li><a href="http://google.com/" title="Google" target="_blank">Google</a></li>
  <li><a href="http://yahoo.com/" title="Yahoo!" target="_blank">Yahoo!</a></li>
  <li><a href="/Welcome.php" class="firstitem" title="Welcome">Welcome</a></li>
  <li><a href="/About_Us.php" title="About Us">About Us</a>
    <ul>
      <li><a href="/What_We_Do.php" title="What We Do">What We Do</a></li>
      <li><a href="/Our_Services.php" class="lastitem" title="Our Services">Our Services</a></li>
    </ul>
  </li>
  <li><a href="/Portfolio.php" title="Portfolio">Portfolio</a>
    <ul>
      <li><a href="/Our_Designs.php" class="lastitem" title="Our Designs">Our Designs</a></li>
    </ul>
  </li>
  <li><a href="/Volunteer.php" title="Volunteer">Volunteer</a></li>
  <li><a href="/Contact_Us.php" title="Contact Us">Contact Us</a>
    <ul class="lastsublist">
      <li><a href="/Getting_Started.php" class="current" title="Getting Started">Getting Started</a></li>
      <li><a href="/Quotes.php" class="lastitem" title="Quotes">Quotes</a></li>
    </ul>
  </li>
  <li><span class="novariant">&#169; 2011 Company Name. All Rights Reserved.</span></li>
</ul>
</div>

Demo

Download a demo template that uses three instances of the navigation functions.

Comments

Please post your comments, questions, or suggestions here.

* Denotes a required field.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent Posts: