What's the best (or a best) way to display a menu based upon the value of a cck field attached to the current node?

My use case is that I want to allow users to specify, via a cck list field, which one of several available menus they want to appear with a given page. But when the block theme hooks/templates get run there doesn't seem to be a reference to the current node available.

Thanks!

Comments

nevets’s picture

You could use the block visibility and PHP mode with code something like

<?php
$node =  menu_get_object();
if  ( !empty($node) )  {
  // Use  your  field to determine if code should return  TRUE or FALSE
}

return  FALSE;
?>

An alternate approach and probably easier is to use the Block Reference module to make a field for selecting which block (menu) to display and then using CCK Blocks to display that field in a block.

jaskho’s picture

Exactly what I needed -
menu_get_object();
Thanks!!