Using pdoMenu to Create Bootstrap 3 Main Navigation Bar

Using pdoMenu to Create Bootstrap 3 Main Navigation Bar

Drop-in Snippet Call for use with Bootstrap 3.

Posted on May 09, 2015 at 15:02:00
Tags: Bootstrap3, pdoMenu, pdoTools, Wayfinder
Words: 302
Level: Beginner
Dependencies: None

The intention of pdoMenu is to be a drop-in replacement for Wayfinder. For most applications users may find this to be true, while others may find inconsistencies which can cause some confusion.

Snippet Call


[[pdoMenu?
	&displayStart=`1`
	&parents=`0`
        &resources =`-90`
       	&level=`1`
	&sortBy=`menuindex`
	&sortdir=`ASC`
        &scheme=`full`
	&hideSubMenus=`1`
	&tpl=`@INLINE <li [[+classes]]> <a href="[[+link]]" title="[[+pagetitle]]" [[+link_attributes]]>[[+menutitle]]</a>[[+wrapper]]</li>`
	&tplOuter=`@INLINE <ul class="nav navbar-nav nav-primary">[[+wrapper]]</ul>`
	&titleOfLinks=`menutitle
	&cacheResults=`1`					
	&hereClass=`active`
        &innerClass= `here`
        &outerClass=`nope`
]]

Inconsistencies (1.11.1-pl)

When setting up the snippet call above, I attempted to use as many parameters as necessary to create the menu. The problem is, some of the attributes are simply ignored even though they are present in the code.

&outerClass
is supposed to replace the +classes placeholder in the &tplOuter with the values established at runtime via the parameter. Only classes="" is returned. If a dedicated snippet is used, the values appear.
&innerClass
Also does not work, though first, last, and active classes will appear in the +classes placeholder in the @tpl as expected.

Advantages

The advantages of pdoMenu are many. The ability to place templates inline with the Snippet Call or on the File system can both be seen as highly beneficial for applications which can be of use to those desiring to bypass the necessity of the Element Tree.

Front-end developers can keep the HTML on the page facilitating new layout design. Package developers, on the other hand, can store their components on the file system.

Notes

Even with the inconsistencies, I prefer pdoMenu over Wayfinder and getResources due to the additional tools which it includes. pdoResources can also be used for menus, navigation layouts, and side menus.

MODX:
Website development platform combining security, power, and innovation.