I absolutely adore the control this module gives over display of child menu items on each node.

I would like to see a second module that would have this same control over the display of brother/sister items to the node. I suggest this as a separate module because I could see using two blocks on a page, one for brothers/sisters, one for children, to really help in navigation.

The only other item I could suggest is greater control over the block title, but being a non-coder, I have no idea how hard that would be.

Thanks again for contributing such a great module.

Comments

bengtan’s picture

Assigned: Unassigned » bengtan

Thanks for your feedback and encouragement.

I think displaying sibling nodes is a good idea. Unfortunately, I'm busy with some other matters at the moment, but hopefully I'll be able to give it some attention in a week or so's time. Having done child nodes, doing the same with sibling nodes isn't that much more different.

You can override the block title from the block's configure link. See

http://yoursite.com/admin/build/block

or possibly

http://yoursite.com/admin/build/block/configure/submenutree/0

Although if you override it in this manner, the block title won't change with different nodes. Does that help with what you want?

DrupalBone’s picture

I sincerely apologize for not getting back to you sooner. Thank you for your willingness to pursue this request for a sibling menu.

I consider the menu title not a big issue, but it would be interesting to have some direct control over the menu title per node. For example, if I have a child menu of individual states, submenutree would put the parent menu item as the title, in this example I'd say "USA". I would like to have the control of the title to say "USA Navigation" or "Explore further into the US". But this would be specific to the node page, just as the submenutree is controlled on a per node basis.

Of course that would probably be a monster to work out in comparison to a sibling menu module or something like that.

Anyways, thanks again, I'm heading to my test site to submenutree-ize some more nodes right now.

bengtan’s picture

You know, I think you've got a point there. At the moment, I've derived the block title from the node title. There's an argument that I should be deriving from the menu title instead. Let me get back to you on this.

bengtan’s picture

Status: Active » Fixed

I've made a 0.4 release with configurable titles and sibling menu tree functionality. Please have a look and give it a try, but make sure you read the upgrade instructions though.

DrupalBone’s picture

Superb!!! I will check that out ASAP!

DrupalBone’s picture

Wow! This thing rocks hard now! I'll be sure to let you know when my site goes live so you can see it in action.

I send many thanks, and hope this is put into drupal core someday... talk about essential!

My only extra thought now is whether there is a way to exclude the node you are on from the siblingmenu list, I suppose as a configurable option.

But regardless of whether that is possible or not, the module as is gets my highest praise... thank you.

bengtan’s picture

Thanks, and you're welcome.

>> My only extra thought now is whether there is a way to exclude the node you are
>> on from the siblingmenu list, I suppose as a configurable option.

Uh, I thought about this, and I decided ... no. I think it's safer not to attempt this.

When displaying as a menu, I can only exclude the current node by removing it from the Drupal menu hierarchy, and I'm not messing around with that. Hence, if I can't remove it when displaying as a menu, I shouldn't remove it when displaying in other ways (ie. teaser, full text).

If you really really need to exclude the current node, you can override the themeable functions and do it there, if you think it's worth the effort.

DrupalBone’s picture

That's all good. Do you think it would be a difficult thing to override by a themeable function? I'm embarrassed by how little I know about the theming system altogether, at best I'm a guy who writes HTML/CSS by hand. I don't know anything about "if" statements.

bengtan’s picture

Generally, overriding a themeable function isn't hard, but you do have to know php and Drupal theming, and know them well.

For this scenario, it's a bit more complicated as well, because you'll have to sort through a list of nodes to find the main one that's being displayed, and then exclude it.

So, my short answer is ... don't try it unless you really know what you're doing. The slightly longer answer is ... to go and learn php and Drupal coding, or find someone to do it.

DrupalBone’s picture

Just as a follow-up, I found this script in another forum post... that I deleted an undesired part from... and by putting it into my theme's template.php it doesn't display the menu item of the current node, making the siblingmenutree truly rock!

The only problem I'm having is that even though it removes the menu item, it doesn't remove the li code that would go around it.

<li class="leaf"></li>

The only problem with this is that it shows a bullet for this entry even though the menu item isn't shown. I want to have the bullets on the menu item list, so removing all bullets won't work. I'll be looking into this.

Here is the code to remove the menu item though:

 function phptemplate_menu_item_link($item, $link_item) {

/***
  *  - no link tag is provided on the menu item for the current page
  */

  $this_page = menu_get_active_title();

  $linked_item   = l($item['title'], $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL);

  if ($item['title'] == $this_page || drupal_is_front_page() && $item['title'] == "Home" || $active) {
    return $unlinked_item;
  }

  else {
    return $linked_item;
  }

}

So now I'm a good way there... just need to figure out how to disable that li and It'll be smoking.

DrupalBone’s picture

Oh yeah... this is the original link to the code I modified:

http://drupal.org/node/171529

And here was his code

<?php
function phptemplate_menu_item_link($item, $link_item) {

/***
  * Overrides the HTML output for all links in block menus
  *  - no link tag is provided on the menu item for the current page
  *  - <strong> tags are added to the current page's menu item, to emphasise it as the current page.
  */

  $this_page = menu_get_active_title();

  $unlinked_item = "<strong>". $item['title'] ."</strong></li>\n"; // causes menu to stop at this p
oint.

  $linked_item   = l($item['title'], $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL);

  if ($item['title'] == $this_page || drupal_is_front_page() && $item['title'] == "Home" || $active) {
    return $unlinked_item;
  }

  else {
    return $linked_item;
  }

}
?>

In case anyone visiting this thread is interested.

bengtan’s picture

It's purely coincidental that I was doing some theming recently which also had to handle the current node/page specially in the menus. I've modified it to exclude the current node/page.

function yourtheme_menu_item($mid, $children = '', $leaf = TRUE) {
  // derived from menu_item_link()
  $item = menu_get_item($mid);
  $link_item = $item;
  while ($link_item['type'] & MENU_LINKS_TO_PARENT) {
    $link_item = menu_get_item($link_item['pid']);
  }
  $link = theme('menu_item_link', $item, $link_item);

	if ($link_item['path'] != $_GET['q']) 
		return '<li class="'. ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) .'">'. $link . $children ."</li>\n";
}

You might find this more useful. Replace that script fragment you found with this one and see how you go.

DrupalBone’s picture

I just gave that code a shot but the page wasn't removed from the siblingmenu list. Its color was changed to black though. I'm using zen as my theme, so maybe that is part of it?

Revised... scratch that, I used my brain for a second and figured it out. Anyone using this be sure to change "yourtheme" to your theme name.

But wow bengtan... this is a complete solution now if there ever was one. I am giving you my highest appreciation once again.

DrupalBone’s picture

I just realized that this causes a bit of a problem for me.

In my drupal install I have two main menus... my user menu which includes "my account, administer, create content" and the other menu is my site navigation, like my example above "USA, states..."

My problem is that whereas I would like for the items to be removed from the site navigation list, I would like the normal tree structure to work on the user menus.

So my question is, is there a way to make this template script/function target only one menu tree and not the other?

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.