[All Adaptavist Apps]

Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

{wikimenu} Macro

Description

This macro is used to embed wiki notation menus and the output from other macros (such as the {children} macro) in to a menu.

Requirements

This macro requires [Theme Builder 2.0] or above.

Usage

{wikimenu}
* MyMenu
** My Option
** ----
** Sub menu {children:page=Home}
{wikimenu}

Parameters

This macro has no parameters.

Examples

Basic Wiki Menu

You can define menu items using the wiki notation for an unordered list as shown below:

* [Home]
** [Builder Macros|Macros|Find out more about macros...]
** ----
** [Confluence]

If the list above is added to a normal wiki page, you'll see:

Unknown macro: {div}
  • [USERGUIDE:Home]
    • [Builder Macros]

    • [USERGUIDE:Confluence]

To add this block of links in to a menu, use the wikimenu macro:

{wikimenu}
* [Home]
** [Builder Macros|Macros|Find out more about macros...]
** ----
** [Confluence]
{wikimenu}

Which will give:

Unknown macro: {menubar}
Unknown macro: {wikimenu}

Mixing with Menu Macros

The primary purpose of the wikimenu macro is to allow much better integration of menu macros and wiki notaiton within menu definitions, as shown in the example below:

{menu}{menulink:home}{menuicon:house} Home{menulink}
{wikimenu}
* [Builder Macros|Macros|Find out more about macros...]
* ----
* [Confluence]
{wikimenu}
{menu}
{viewmenu}
{editmenu}

As you can see, we've replaced the "Home" link from the previous example with some menu macros and then inserted our wiki notation menu beneath it. We've then added the standard [view menu] and [edit menu] on to the menu bar, resulting in:

Unknown macro: {menubar}
Unknown macro: {menu}
Unknown macro: {menulink}
Unknown macro: {menuicon}

Home

Unknown macro: {wikimenu}
Unknown macro: {viewmenu}
Unknown macro: {editmenu}

The menu macros are generally faster to use, more reliable and strictly adhere to privileges and system settings. So why on earth would you want to use wiki notation menus in the first place? Read on...

Dynamic Menu Creation

Builder has always allowed automated menu creation, however there are some cases when it's a little unreliable. The new wikimenu macro allows you to safely embed other Confluence macros inside menus with far fewer side effects:

{menu}{menulink:home}{menuicon:house} Home{menulink}
{wikimenu}
{children:page=Home}
{wikimenu}
{menu}

This will result in:

Unknown macro: {menubar}
Unknown macro: {menu}
Unknown macro: {menulink}
Unknown macro: {menuicon}

Home

Unknown macro: {wikimenu}
Unable to render {children}. Page not found: Home.

The benefit here is that if the {children} macro (or any other macro you are using) fails, you won't see a nasty error message in your menus.

Reusable Menu Chunks

One much requested feature was the ability to create chunks of menu that could be re-used across multiple spaces. The wikimenu macro makes this possible...

{wikimenu}
{include:Sample Menu}
{wikimenu}

Which results in:

Unknown macro: {menubar}
Unknown macro: {wikimenu}
Error formatting macro: include: java.lang.IllegalArgumentException: No link could be created for 'Builder:Sample Menu'.

How does this work? Well, we've created a page called [USERGUIDE:Sample Menu] and then added a chunk of menu to it. The {include} macro is then used to import the menu definition from the [USERGUIDE:Sample Menu] page.

The menu chunk on the sample page was created as follows:

{menu}{menulink:home}{menuicon:house} Home{menulink}
{wikimenu}
{children:page=Home}
{wikimenu}
{menu}
{menuseparator}
{viewmenu}
{editmenu}

If you look at the [USERGUIDE:Sample Menu] page and you'll see that the menu items are simply displayed as a normal unordered list:

Unknown macro: {div}
Error formatting macro: include: java.lang.IllegalArgumentException: No link could be created for 'Builder:Sample Menu'.

You can create any number of "menu pages" containing chunks of menu items and then import them this way in to any number of locations around your site.

CSS Customisation

To follow.

Hints and Tips

None at present.

Frequently Asked Quesitons

None at present.

  • No labels