Usage

The Minumum Wayfinder Call

The snippet call [!Wayfider? &startId='0'!] will produce an unordered list of all the documents in the MODx document tree that MODs allows the the current user to see. This means that documents will not be listed if they are: unpublished, unauthorized for the current user, or hidden from use in menus. The unordered list generated by Wayfinder will be indented to match any heirarchy present in the MODx document tree.

For many web developers this output is all that's needed, since most contemporary techniques for producing fancy navigational menus are produced by using CSS to style unordered lists. For examples see http://www.cssplay.co.uk/ and http://css.maxdesign.com.au

Using Wayfinder as a Replacement for DropMenu

Some older templates may use the deprecated DropMenu snippet instead of WayFinder. The DropMenu snippet is not included in MODx 0.9.5 or above. These templates can often be easily updated to use Wayfinder instead of DropMenu.

This DropMenu call:
[!DropMenu? startDoc='0' &levelLimit='1'!]
Can be replaced by:
[!Wayfinder? &startId='0' &level=1!]

Starting in the Middle of the MODx Document Tree

Calling Wayfinder with the &startItem parameter set to "0" tells Wayfinder to start at the root of the MODx document tree and to (potentially) list all documents in the entire tree. But you can have Wayfinder start anywhere you want in the tree by setting the &startItem parameter to the ID of the document one level above where you want the listing to start. Thus Wayfinder always lists the descendants of the document specified in the &startItem parameter but does not include this "starting" document in the listing.

Limiting How Many Levels are Shown

By default, Wayfinder will list all the (visible) descendants of the specified starting document no matter how many levels deep they may be nested in the MODx document tree. You can override this behaviour by using the &level parameter to specify the number of levels of hierarchy you wish to include in the listing. For example:

The snippet call [!Wayfinder? &startId='XXX' &level='1'!] will make Wayfinder list only the immediate children of the the document whose ID is XXX.

The snippet call [!Wayfinder? &startId='XXX' &level='2'!] will make Wayfinder list the children and the grandchildren (i.e. two levels of heirarchy) of the the document whose ID is XXX.

To include all levels of descendants you can either call Wayfinder without the &level parameter, or can set &level='0'.

Applying CSS Styles to the Output

Use the CSS-related parameters described below to assign CSS classnames to specified portions of Wayfinder's output, then make sure that the current webpage contains or references a corresponding CSS stylesheet. There's also a Wayfinder parameter for forcing a specified stylesheet to be referenced by any webpage in which Wayfinder is called.

Producing Custom-Formatted Output

Many users find that simply using CSS to style Wayfinder's default, unordered list ouput gives them enough flexibility. But if you want the basic HTML structure of Wayfinder's output to be otherwise, you can create your own templates to force Wayfinder to output HTML tables, XML data, or pretty much whatever other text-based format you might need.

See the sections below on Template Parameters, and Templates and Placeholders.

Applying JavaScript Behaviors to Wayfinder Output

JavaScript and JavaScript calls may be embedded in any custom templates that you create. And there's also a Wayfinder parameter for forcing a specified JavaScript file to be referenced by any webpage in which Wayfinder is called.

PR

  • KAGOYA
  • ASP at AKIHABARA Japan
  • CMS AWARDS 2007 Winner
ページトップへ