I have this menu:
Projects
--Data
--Type
--Year
Proyectos
--Datos
--Tipo
--Año

All submenus are list of projects, so when a project its open I need to make active the referer page (Data,Type,Year). So how can I make it active?.

Thanks in advance.

Comments

FiNeX’s picture

I have the same problem :-(

etion’s picture

I solved it in that way, I dont know if its the correct way but it works.

$nodostring=$_SERVER['HTTP_REFERER'];
$nodo=substr($nodostring,strrpos($nodostring,'/')+1);
//We know the referer page so if the $nodo its equal to Data or Datos ,  Type or Tipo...., we set the menu item
if ($nodo==8 || $nodo==43 || $nodo==44 || $nodo==9 || $nodo==28 || $nodo==47 || $nodo==10  || $nodo==29 || $nodo==46 || $nodo==11 || $nodo==30 || $nodo==45) { 
        $router_item = menu_get_item("node/$nodo");
        menu_set_item("node/$nid", $router_item);
}
else {
//Default menu item
}
FiNeX’s picture

Your solution is difficult to mantain: every time you add a node you've to edit the sourcecode.

I've partially solved with http://drupal.org/project/nodetrail which works in a lot of use cases (not all, but the most generic).

Lukas von Blarer’s picture

hi etion

where have you put that code?

is there a better solution?

thanks

lukas

Lukas von Blarer’s picture

hi again

i do the following:

function fondation_beyeler_init() {
	if (arg(0) == 'node' && is_numeric(arg(1))) {
	$node = node_load(arg(1));
	$type = $node->type;
		if($type == 'artist') {
			$router_item = menu_get_item("node/196");
			menu_set_item("node/196", $router_item);
			echo $router_item['title'];
			$router_item = menu_get_item();
			echo $router_item['title'];
		}
	}
}

the first echo returns the right page title, the second one doesnt.

any ideas?

thanks

lukas

JohnAlbin’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)