PHP AutoNav

Permalink 1 user found helpful
Hi,

Can anyone explain or link me on how I can create a nests UL/LI navigation list of all of my pages,sub-pages for a suckerfish style navigation.

I don't want to use the plug-in because I want to throughout the whole site.

I have tired, and looked at the actual autonav controller.php code, yet failed :( only to get the first tier.

I can style it up, just need the PHP to generate the full nav.

rainmaker
 
cannonf700 replied on at Permalink Reply
cannonf700
See Remo's Drop-Down Navigation tutorial on the second page of this site:

http://www.codeblog.ch/category/concrete5/...
johndorsay replied on at Permalink Reply
johndorsay
Here's the code that i use

<?php 
   defined('C5_EXECUTE') or die(_("Access Denied."));
   $aBlocks = $controller->generateNav();
   $c = Page::getCurrentPage();
   echo("<ul class=\"nav-header\">");
   $nh = Loader::helper('navigation');
   $isFirst = true;
   $i=0;
   foreach($aBlocks as $ni) {
      $_c = $ni->getCollectionObject();
      if ($_c->getCollectionAttributeValue('header_nav')) {
         if ($ni->isActive($c) || strpos($c->getCollectionPath(), $_c->getCollectionPath()) === 0) {
            $navSelected='nav-selected';
         } else {
            $navSelected = '';


I have also included and external_nav attribute that checks for a page attribute and if it exists will direct the link to any url needed.

Paste this code into blocks/autonav/templates/header_nav_with_drop.php
Select the custom template and voila!

Hope it helps. It should be fairly straight forward if you know some php.

-JD