Valid XHTML 1.0 Transitional

show_menu2, version 4.6

See http://code.jellycan.com/show_menu2/ for documentation.

function show_menu2(
    $aMenu          = 0,
    $aStart         = SM2_ROOT,
    $aMaxLevel      = SM2_CURR+1,
    $aFlags         = SM2_TRIM,
    $aItemOpen      = '[li][a][menu_title]</a>',
    $aItemClose     = '</li>',
    $aMenuOpen      = '[ul]',
    $aMenuClose     = '</ul>',
    $aTopItemOpen   = false,
    $aTopMenuOpen   = false
    )
Oompa << | (no parent) | >> Site Map

Show code

Full Menu

show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_NUMCLASS|SM2_PRETTY, false, false, '<ul class="mark [class]">');

Using CSS selectors to show parents (p), current (c), sibling (s) and children (c-N).

Note: the CSS selectors works only in modern browsers. IE6 is not a modern browser.

Sitemap

show_menu2(SM2_ALLMENU, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_ALLINFO, '[li]<span class="content">[a][page_title]</a> (menu: [a][menu_title]</a>)<br /><i>[description]</i><br />([keywords])</span>', false, '<ul class="sitemap [class]">');

UDM4 Popup

show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, false, "\n</li>", false, false, false, '<ul class="udm" id="udm">');

See UDM4.

Default (Trimmed)

show_menu2();

Note: this is the default output

Breadcrumbs (all)

show_menu2(0, SM2_ROOT, SM2_CURR, SM2_CRUMB, '<span class="[class]"> > [a][menu_title]</a>', '</span>', '', '', '<b>You are here:</b> <span class="[class]">[a][menu_title]</a>');

Breadcrumbs (max 2 levels)

show_menu2(0, SM2_ROOT, SM2_MAX+1, SM2_CRUMB, '<span class="[class]"> > [a][menu_title]</a>', '</span>', '', '', '<b>You are here:</b> <span class="[class]">[a][menu_title]</a>');

Full Menu (OL)

show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, false, false, '<ol>', '</ol>');

Siblings

show_menu2(0, SM2_ROOT, SM2_CURR+1, SM2_SIBLING);

Tree rooted at parent item

// get the page_id of the root item for the current page
$nTreeRootId = (int) show_menu2(0, SM2_CURR, SM2_START, SM2_CRUMB|SM2_BUFFER, '[parent]', '', '', '');

// generate the menu from that root
echo "Current parent = $nTreeRootId";
show_menu2(0, $nTreeRootId, SM2_ROOT, SM2_ALL);

Current parent = 0

Current Tree Only

// generate the menu for the current tree only
show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL|SM2_CURRTREE);

Root Level Only

show_menu2(0, SM2_ROOT, SM2_START);

Children/Siblings

This is often used when splitting menus between the root menu and a side menu showing the children of the current page. This menu will show all of the children of the current top level menu, but will continue to display the siblings of child pages as well when a lower level menu is selected.

show_menu2(0, SM2_ROOT+1, SM2_CURR+1);

Current Level

show_menu2(0, SM2_CURR, SM2_CURR);

Current Kids

show_menu2(0, SM2_CURR+1, SM2_CURR+1);

Root Only (TABLE)

<table border="1">
show_menu2(0, SM2_ROOT, SM2_START, SM2_ALL, '<tr><td class="[class]">[a][menu_title]</a>', '</td></tr>', '', '');
</table>

Root Only (SPAN)

show_menu2(0, SM2_ROOT, SM2_START, SM2_ALL, '<span>| [a][menu_title]</a>', ' |</span>', '', '');

| Home || Enterprise || Time || Oompa || Parent || Site Map || Conditional |

First Level

show_menu2(0, SM2_ROOT, SM2_START);

Second Level

show_menu2(0, SM2_ROOT+1, SM2_START);

Trimmed (all)

show_menu2(0, SM2_ROOT, SM2_ALL, SM2_TRIM);

Children of Enterprise

show_menu2(0, 1, SM2_ALL, SM2_ALL); [page_id of Enterprise is 1]

Max 2 Levels

show_menu2(0, SM2_ROOT, SM2_MAX+1);

Current Kids (all)

show_menu2(0, SM2_CURR+1, SM2_ALL);

Hidden Menu

show_menu2(0, 19, SM2_ALL, SM2_ALL);

This shows the children of a hidden menu. They don't show up in a normal menu listing and can be used to display a fixed set of menu items. The root of the menu is set to the page ID of the hidden parent.

All 2nd level menus

show_menu2(0, SM2_ROOT+1, SM2_START, SM2_ALL);

Root Only (TEXT)

show_menu2(0, SM2_ROOT, SM2_START, SM2_ALL, ' | [a][menu_title]</a>', '', '', '', '[a][menu_title]</a>');

Home | Enterprise | Time | Oompa | Parent | Site Map | Conditional

Full Menu 2

show_menu2(2, SM2_ROOT, SM2_ALL, SM2_ALL);

Show only siblings (not current)

show_menu2(0, SM2_CURR, SM2_CURR, '','[if(class!=menu-current){- [a][menu_title]</a><br />}]','','','<br />');

- Home
- Enterprise
- Time
- Oompa
- Site Map
- Conditional

Original Menu (menu = 2)

show_menu(2);

Original Menu (menu = 0)

show_menu(1);

Full Menu (TABLE): Horizontal

show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, '<td class="[class]">[a][menu_title]</a>', '</td>', '<table class="menu"><tr>', '</tr></table>');

Tests using the show_menu() replacement function

Default

show_menu();

Default

sm2_show_menu();


Fatal error: Call to undefined function: sm2_show_menu() in /home/jellycan/public_html/_code.jellycan.com/sm2test/templates/show_menu2_test/index.php on line 415