Change Autonav classes

Permalink
Hi,

I'm building a theme based on Bootstrap and I want to change the autonav ul class to

<ul class="nav navbar-nav navbar-right">

Please can someone point me in the right direction on how to do this?

thanks
Andy

neopixel
 
rdmedia replied on at Permalink Reply
rdmedia
I would copy the view.php file from concrete/blocks/autonav folder to your blocks/autonav folder and change the class in that file. The autonav will then use that as a template.

You could call the file something other than view.php. Like my_autonav.php Then choose that custom template for the autonav block. It would show up as My Autonav in this case.

Hope that helps.

Nick
neopixel replied on at Permalink Reply
neopixel
Thanks, I'll give that a go at the weekend :)
neopixel replied on at Permalink Reply
neopixel
Hi Nick,

i tried but it didn't see the new files.

Please can you tell me how to make C5 aware of it?

I edited the original file and it works great! Is there a way of getting into the theme directory?

Thanks
Andy
rdmedia replied on at Permalink Reply
rdmedia
Hi Andy,
You need to select the custom template while in edit mode for that autonav block.
If you called it bootstrap_nav.php then it will show up as Bootstrap Nav in the custom template drop down.
neopixel replied on at Permalink Reply
neopixel
Hi Nick, that works thanks :)
neopixel replied on at Permalink Reply
neopixel
Hi,

Now i'm trying to add the bootstrap dropdown behaviour to the ul li

//*** Step 2 of 2: Output menu HTML ***/
echo '<ul class="nav navbar-nav">'; //opens the top-level menu
foreach ($navItems as $ni) {
   echo '<li class="' . $ni->classes . '">'; //opens a nav item
   echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $ni->name . '</a>';
   if ($ni->hasSubmenu) {
      echo '<ul class="dropdown-menu">'; //opens a dropdown sub-menu
   } else {
      echo '</li>'; //closes a nav item
      echo str_repeat('</ul></li>', $ni->subDepth); //closes dropdown sub-menu(s) and their top-level nav item(s)
   }
}
echo '</ul>'; //closes the top-level menu


No joy though. Has anyone solved this? :)