Duplicating Main Navigation menus-links in a site sidebar block

Events happening in the community are now at Drupal community events on www.drupal.org.
opegasus's picture

I ran into a cool function on a site [ http://www.allenacademy.org/ ] that when the user selects a Main Navigation (Main Menu?) link, the entire link and all it's children, were replicated in Sidebar 1 for that series of pages.

To me that made perfect sense, makes it easier for the User to maintain focus on a subset of links plus it helps the Developer to assist the User A) stay focused on a subset of links(Keeps the Users Subset links at the eye level of the content-Designing by the 'F' method, another topic) and B) Keeps the user on the site by driving them deeper into the site.

So when I queried my two Drupal Gurus (Andy Laken & Scott Rouse-creator of the site example above) about this they both sent me to Drupal Modules to select and use Menu_Block [ http://drupal.org/project/menu_block ]

To explain Menu_Block from a newbie's (that's me) experience I am going to assume you already know how to:

  • Download-install Drupal.
  • Download and install Modules (in the correct place!).
  • Navigate the Administrative side of your Drupal site.
  • Enable Modules.
  • Navigate to Blocks.
  • Have a site that is offline to the public or have a practice site or a Dev site to try this first.

As always, it is a good idea to back up your site before mucking about with a new module, etc.


Okay, what I like about this module:

It allows one to:

  • Select any main menu-navigation set and create a block menu copy of that set, that can be put into any block position like Sidebars.
  • Choose to have the child links expand or not.
  • Choose to have the active (user selected) link float to the top of the Block menu or not.
  • Add new menu items (links and content-nodes) to the main menu navigation and it automatically adds the new link to the Block (sidebar) navigation.
  • Select which pages the Block menu appears on.
  • Choose which links that get to appear in the sidebar and what level (Parent-Child-SubChild OR Parent-Secondary-Tertiary) to start or show.
  • It assumes all the CSS of your template in a Block-Left Sidebar-Left Vertical Menu position depending on your placement of the Block_Menu. No Need to code the CSS IF you already have that Block coded, that is.

I am sure there is more but even just those jewels are enough to add this terrific functionality to your site. It isn't for every site but I can't think of an example where it might be good to not use it on.

One thing that stumped me...

...for a bit, is to ensure one has the correct Drupal path when deciding what pages to show or not to show the Menu_Blocks on. (Note: You will see this option at the bottom of the Add-menu-block node-page)

For instance:

I wanted to show one Sidebar menu on certain pages. I kept looking for the node number (i.e. Node/99 ) so I could specify the correct node/page to have the sidebar block menu appear.

Long story short I finally found out that since I had URL auto- Auto aliases turned on I just opened that specific page (in a new tab) and copied the URL all after the main site url and pasted that into a separate line in the include/exclude text box and it worked like a charm.

So to give you an example. If your site is named (www)puppydogs.com and the page (node) you desire to have your Block Menu appear is on (www)puppydogs.com/content/Best dog collars -then copy/paste- content/Best dog collars into a separate line inside the include-exclude text box. Copy the exact URL of the page-node you want to have your Block Menu apprear in. No need to add any (/) or other PTF (Path To File) arguments (or whatever they are called), just the parts after (www)puppydogs.com/ from the displayed URL.

Of course always save your work and then go try it out! If done accurately you now get to say WOW!

Keep in mind that if you do have child-subChild navigattion (Parent/Child/SubChild -OR- Primary/Secondary/Tertiary) levels in a menu then you get to include all those pages (or not) in your Include/Exclude options text box or your Block Menu will NOT show up on the desired pages. It is a specific function that you control.

Well I hope I broke it down clearly enough for someone wanting this feature and there is enough information for you to implement and play with this great Module.

Comments

Block Configuration

scottrouse's picture

Thanks for sharing that, Christopher!

Just a side note for configuring your Blocks. One can specify an individual list of paths, such as:

about
about/scott
about/chris
about/nathan

or you can use the asterisk (*) as a wildcard in your path declarations:

about
about/*

The second chunk of code will cause the Block to appear (or not appear depending on your configuration) on the "about" path and all pages which are subdirectories of about/.

Best,
Scott

Even better, thanks!

opegasus's picture

Scott,

Great side note. I can see it will save a lot of include/exclude manipulations-creations.

Glad I threw in newbie code. :-D

Wildcard for full paths and subdirectories

opegasus's picture

Scott,

I used the wildcard so the full Primary menu would show as a block menu. I must have missed some sort of switch because once the wildcard option was saved, the entire Block Menu disappeared or wouldn't 'print' on the target pages/nodes.

Once I went back to listing each node (separate lines per mini instructions in that Module) that the Block Menu is to appear on, then the Block Menu returned?

As well I went to make the block title active-linked to the node that Primary Nav menu is linked to and the link/title does
not function? It just looks like a static block title header with no functionality.

Any clues?

Pathauto

scottrouse's picture

It may depend on how your Pathauto paths are being rendered. For example, listing:

node/3
node/4
node/5

isn't going to be accomplished by just saying
node/*

if you've created path aliases. You certainly can ensure that a block shows up on specified nodes by listing them individually, but it's typically quicker to list urls with wildcards as if you were specifying directories and subdirectories.

As a real-world example, on the Allen Academy website, you'll see a very simple block with a "Rams Football" logo on the right sidebar on the Football page as well as its "sub-pages" (Varsity and Middle School).

The Page specific visibility settings for that block (with Show on only the listed pages selected is

athletics/football
athletics/football/*

So, that's just block stuff. The Block Menus appearance settings should function identically.

As far as your title linking, you should be able to set that in the Block specific settings (admin/build/block/configure/menu_block/[block_id]) for that Menu Block. Make sure you're not trying to override the Block title, as that will keep you from linking that title.

I may have to glance at your specific situation on Thursday to try to shed some light.

-Scott

Thanks, one of two solved.

opegasus's picture

I missed or didn't understand the Block Title Link override.

Your directions helped me solve that, thanks.

Perhaps a gander at the site Thursday by you will solve the wildcard issue.

-Christopher

adding existing content to a menu-block menu

DocDJ-forum's picture

I apologize if this is not the right place for this question/problem. Hopefully someone can point me in the right direction.
I have number of existing content blocks (articles & pages). They are currently found via hand-written links in an ordinary block on my home page. I want to replace that pseudo-menu block by putting links to these existing items in my menu-block, but I can't figure out how to do anything but create a NEW content item. The existing items are too big to retype and would involve a lot of copying and pasting to create new ones.

Is there a way to do this using my menu block module? The menu-block is set as "navigation, left side-bar".

Western Montana

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week