UDT to get parent not root node
Posted: Thu Dec 20, 2007 10:11 am
I have this UDT which retreives the root node.
Can anyone help me create a UDT that retrieves the parent?
Thanks
Dan
Code: Select all
global $gCms;
global $smarty;
$manager =& $gCms->GetHierarchyManager();
$var = 'root_page_alias';
if( isset($params['assign']) && $params['assign'] != '' )
{
$var = $params['assign'];
}
$result = "NO RESULT";
$thisPage = $gCms->variables['content_id'];
$currentNode = &$manager->sureGetNodeById($thisPage);
while( isset($currentNode) && $currentNode->getLevel() >= 0 )
{
$currentContent =& $currentNode->getContent();
$result = $currentContent->Alias();
$currentNode =& $currentNode->getParentNode();
}
$smarty->assign($var,$result);
Thanks
Dan