{$root_alias}, {$root_id}, {$is_root}, {$page_level} in template. This UDT does not use sql queries.
Code: Select all
global $smarty;
$op = $smarty->get_template_vars('content_obj');
$current_id = $smarty->get_template_vars('content_id');
$temp = explode('/', $op->mHierarchyPath);
$root_alias = $temp[0];
$temp = explode('.', $op->mIdHierarchy);
$root_id = $temp[0];
if ($temp[0] == $current_id){
$is_root = 1;
$page_level = 1;
}
else{
$is_root = 0;
$page_level = array_search($current_id, $temp, true);
$page_level++;
}
$smarty->assign('root_alias',$root_alias);
$smarty->assign('root_id',$root_id );
$smarty->assign('is_root',$is_root );
$smarty->assign('page_level',$page_level);
return;