How to present a global menu across multiple subsites

I've been trawling the Drupal site for answers to this and because I'm only 4 days into my Drupal 7 adventure I'm sure half my battle is finding the right words to say to the community to get what I'm asking for.

This question seems to hit the mark http://drupal.org/node/1428516

But the only answer is something about Domain Access http://drupal.org/project/domain but that looks pretty complicated when all I want to do is to splat a small block of html at the top of all my sites.

So I'm thinking the architecture would be something like this.

master site
+ - menu-global-menu    
+ - global-menu-module (looks in master site db for menu-global-menu 
                        and fills variable $global_menu) 
+ - corporate theme (requires global-menu-module)
+ - > subsite 1
+ - inherits corporate theme
+ - > subsite 2
+ - inherits corporate theme

Does this make sense? Or should I be achieving this some other way?

1 Answer 1


So I think I've gone a long way to achieving this.

In the setting.php file of each site I declare a Data Connection called globalmenu that point's to the database belong to the menu's management site.

I make the menu and get the machine name for it; in my case menu-global-menu.

In my page.tpl.php of my theme I have included this

  if ($global_menu){

My module

function global_header_preprocess_page(&$variables, $hook) {

 $query_options['target'] = 'globalmenu';   

 $query = db_select('menu_links', 'p', $query_options)
    ->condition('menu_name', 'menu-global-menu', '=')

 if($query->rowCount() ==   0) {
    print '<div class="messages error"><em>No Global Header Configured!</em><ul><li>Check the Global Header Module Help for details</li><ul>   </div>';

 $links = array();  
 $markup = "<div class='global-navigation'><ul class='nav'>";

 foreach ($query as $item) {    
    $markup = $markup ."<li><a href='".$item->link_path."' class='global-link'>".$item->link_title."</a></li>";

 $markup = $markup ."</ul></div>";  
 $variables['global_menu'] = $markup;

There's probably a much better way of doing the markup but I'm a noob so I guess someone will correct me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.