Customizing Dropdown Menu

Permalink
Hello. I've built a CSS dropdown menu, which I've embedded into my site theme.

I'm trying to figure out how to hard-code the view.php file so that ONLY ONE page allows drop-downs. I see how it can be controlled with the "exclude from nav" checkbox in the page settings. But I want to make this as close to fool-proof as possible for the client.

The idea is to modify the php file so that a submenu would appear ONLY if the parent = "page name"

Here's my view.php file. I think I need to change the getCollectionAttributeValue to exclude all page names except the one I want to use, but I just can't seem to crack it. Can anyone point me in the right direction?

Thanks

<?php 
   defined('C5_EXECUTE') or die(_("Access Denied."));
   $aBlocks = $controller->generateNav();
   $c = Page::getCurrentPage();
   echo("<ul id=\"p7menubar\">");
   $nh = Loader::helper('navigation');
   //this will create an array of parent cIDs 
   $inspectC=$c;
   $selectedPathCIDs=array( $inspectC->getCollectionID() );
   $parentCIDnotZero=true;   
   while($parentCIDnotZero){
      $cParentID=$inspectC->cParentID;
      if(!intval($cParentID)){
         $parentCIDnotZero=false;
      }else{

 
RadiantWeb replied on at Permalink Reply
RadiantWeb
I'm just confused why you are not having two page types. one for the page with the dropdowns, and another for all the rest. maybe I don't understand the reason why you need both in one.
Metaglyphics replied on at Permalink Reply
The site has one template, with the navigation embedded as such:

<?php   
 $bt_main = BlockType::getByHandle('autonav'); 
 $bt_main->controller->orderBy = 'display_asc'; 
 $bt_main->controller->displaySubPageLevels = 'all'; 
 $bt_main->controller->displaySubPages = 'all'; 
 $bt_main->render('view');  
 ?>


But I want to make sure that the dropdown only appears for one item on the list. Other pages might have sub-pages, but only one section needs them to appear as dropdowns.

That is, if the top-level pages are: Home, About, Locations, and Contact, I only want the dropdown items to appear for Locations. If the client adds pages under About, they should not appear on the navigation.
RadiantWeb replied on at Permalink Reply
RadiantWeb
i c.

I believe there is a "relevant sub-pages" option in the autonav block. that may require appropriating the pages in a specific way though.

To honest I have never used "relevant sub-pages"....so maybe my interpretation is off there. ;-P

If someone has used that option well, please share for the rest of us :-P.

C
RadiantWeb replied on at Permalink Reply
RadiantWeb
just wondering how people are actually using the "relevant sub-pages" option in the autonav. now I'm curious. ;-P
Metaglyphics replied on at Permalink Reply
I haven't gotten very far with that. But I did have an idea to try creating a Page Attribute called Dropdown, and rewriting the view.php to suppres pages from the nav unless Dropdown is checked. My JavaScript is a bit rusty, so I'm slogging through that now. I think I've proven the concept, because my view.php file is currently causing the exact reverse of what I want. That is the Dropdown checkbox is suppressing the items from the menu.

So I'm getting close...
RadiantWeb replied on at Permalink Reply
RadiantWeb
what's the reason you can't use "exclude from navigation" check box again?
Metaglyphics replied on at Permalink Reply
Aha. Apparently, I'm trying to reinvent the wheel. Thanks for point that out!

Okay, so the existing EXCLUDE checkbox does the trick.

I was more or less building the same thing. But that leaves me with the questions, is it possible to change this feature so it's an opt-in rather that opt-out? I'd rather have the client specify when they DO want a page to be in the dropdown nav rather than have it default to that.

EDIT: Yep, like most things with C5, it turns out to be pretty easy. I realized I could just set the default to checked. So... never mind. Thanks, everyone.