Page 1 of 1

getting node with hierarchy in menu template

Posted: Sat Mar 03, 2012 9:04 am
by pajo
Is there a method/function that i could use in a (menu) tamplate to get a node via hierarchy?

for example i'm on page 1.2.3 and i want to get the (parent) node 1.2

my problem is that if i'm on a page i need to get the parent node's alias and i think the best way is through hierarchy.

my menu hierarchy looks like that
1. lang1
1.1 goods
1.1.x
1.2 services
1.2.x
2. lang2
2.1 other goods
2.1.x
2.2 other services
2.2.x

whenever i'm on the x level, i need to know the upper level aliases (goods, services). i have 2 menus (goods, services) for each language and i don't even get to touch the goods or services nodes, i only loop the x ones.

thanks in advance

Andres

Re: getting node with hierarchy in menu template

Posted: Sat Mar 03, 2012 10:15 am
by pajo
temporarily fixed the problem with UDT that eats node id's for params:

global $gCms;

$manager =& $gCms->GetHierarchyManager();
//$thisPage = $gCms->variables['page_name'];
$current = &$manager->sureGetNodeById((int)$params['id']);
$h = $current->getParent()->getContent();

echo($h->Name());

Re: getting node with hierarchy in menu template

Posted: Sat Mar 03, 2012 8:44 pm
by calguy1000
Look at the CGSimpleSmarty module.