UDT to display list of active sub pages [Solved]
Posted: Thu Oct 13, 2011 1:15 am
So I'm almost there, thanks to this UDT code - http://wiki.cmsmadesimple.org/index.php ... rrent_page
But - it displays inactive pages as well, which isn't what I want. I need it to filter out the inactive pages, but not too sure which calls I need to make - I'm a newbie^2 when it comes to this kind of smarty stuff. There are a couple examples on that same page linked above working with active pages, but not too sure how to incorporate into the above code.
Code: Select all
global $gCms;
$manager =& $gCms->GetHierarchyManager();
$thisPage = $gCms->variables['page_name'];
$currentNode = &$manager->sureGetNodeByAlias($thisPage);
$nodes = $currentNode->getChildren();
if ($currentNode->hasChildren()) {
echo '<ul class="customlist">';
foreach ($nodes as $node) {
$content= $node->getContent();
$url = $content->GetURL();
if ($url == "#") { /* section header has no link by default */
$url = "index.php?page=".$content->Alias();
}
echo "<li><a href=\"".$url."\">".$content->MenuText()."</a> </li>";
}
echo "</ul>";
}