Code: Select all
global $gCms;
$pos = $gCms->variables['position'];
$base = explode('.', $pos);
$totalDepth = count($base);
$parentDepth = $totalDepth;
$count = 0;
foreach($base as $parentLevel) {
$parentLevel = ltrim($parentLevel, "0" );
if($count <= $parentDepth) {
$thisLevel .= $parentLevel . ".";
}
if($count < $parentDepth) {
$theParent .= $parentLevel . ".";
}
$count++;
}
$smarty->assign('h_toplevel', $base[0] * 1);
$smarty->assign('h_parent', rtrim($theParent, "." ));
$smarty->assign('h_this', rtrim($thisLevel, "." ));Can anyone see why this error is happening, so that we can make a bulletproof {hierarchy} UDT?


