Hey,

I'm developing a new site where I have a lot of sub menus that I have arranged into blocks

Carnival
- Corporate

Where - Corporate should invoke a block 'Corporate sub menu'
Which is simply a new menu that I created to contain all the subs of 'Corporate'

My problem is that I want the 'Corporate sub menu' to show for all the elements that it contains

I've tried using this method: http://drupal.org/node/134428

<?php
include_once "./includes/inherit_blocks.inc";

if (check_path("node/1")) return TRUE;

return inherit_display_block(123);
?>

...but obviously my sub menu items are not children of 'Corporate' and hence not showing up for all the items in the block. How can I get around this? I don't want to add the 'Corporate sub menu' items as children of 'Corporate' as they would then appear in my primary links...

view the work in progress here:
http://ripleyandfriends.com/dev/
username: preview
password: 654321

Comments

marcvangend’s picture

The code you're using for block visibility is based on the menu system, but you want to use is on pages that are left out of the menu system. That doesn't feel like a smart combination.
In your situation, I think I would create a vocabulary (enable the taxonomy module first if necessary) so you can tag the corporate pages with the term 'corporate'. The block visibility code could be:

$tid = 2; // Change this value to the correct Term ID.

if (arg(0) == 'node' && is_numeric(arg(1)) ) { // Check if we're viewing a node.
  $node = node_load(arg(1));
  return (bool) $node->taxonomy[$tid];
}
tagsko’s picture

Thanks marcvangend, that worked a charm!

marcvangend’s picture

Thanks for the feedback, glad I could help.

gys’s picture

ive been looking for this for a very very long time :))
you saved my day