Bootstrap 3 with Concrete 5.6 Auto Nav Template

Permalink
<?php  defined('C5_EXECUTE') or die(_("Access Denied."));
$navItems = $controller->getNavItems();
/**
 * The $navItems variable is an array of objects, each representing a nav menu item.
 * It is a "flattened" one-dimensional list of all nav items -- it is not hierarchical.
 * However, a nested nav menu can be constructed from this "flat" array by
 * looking at various properties of each item to determine its place in the hierarchy
 * (see below, for example $navItem->level, $navItem->subDepth, $navItem->hasSubmenu, etc.)
 *
 * Items in the array are ordered with the first top-level item first, followed by its sub-items, etc.
 *
 * Each nav item object contains the following information:
 *   $navItem->url        : URL to the page
 *   $navItem->name       : page title (already escaped for html output)
 *   $navItem->target     : link target (e.g. "_self" or "_blank")

samuelbarney
View Replies:
acdotme replied on at Permalink Reply
Hi,

Thanks for posting this. I've been trying to find a good way to work with Bootstrap's styles with the autonav. I'm a bit of a noob with php, I've read the notes in the file but I'm having some trouble trying to add the Bootstrap style names to the arrays and can't get dropdowns to work.

Any chance you could give some more instructions on how to use this?

Thanks in advance!
scottM1164 replied on at Permalink Reply
scottM1164
I've been playing with this template and it seems to work quite well. To use it you basically create a custom template and apply it to the autonav block.

To create a custom template you take SamB's code and paste it into an empty file and name it something like "b3_autonav.php" and save it to "yourrootdirectory/blocks/autonav/templates". Next, if you go to edit your autonav you'll see the "custom template" option from the drop-down list, just click that and you be sent to the custom templates page. You should be able to select your custom template from the drop-down list, and that's it!