getting node with hierarchy in menu template

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
pajo
New Member
New Member
Posts: 2
Joined: Sat Mar 03, 2012 8:48 am

getting node with hierarchy in menu template

Post 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
pajo
New Member
New Member
Posts: 2
Joined: Sat Mar 03, 2012 8:48 am

Re: getting node with hierarchy in menu template

Post 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());
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: getting node with hierarchy in menu template

Post by calguy1000 »

Look at the CGSimpleSmarty module.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “CMSMS Core”