Page 1 of 1

How to print one page section in website?

Posted: Tue Aug 30, 2011 6:12 am
by subbuindesign
I want to show list of all current section pages including parent page and child pages in all that section parent and child pages.

I am using below code, but it is working on parent page only. When I open any child page that list not coming, because of there is no child pages in sub pages.

global $gCms;
$manager =& $gCms->GetHierarchyManager();
$thisPage = $gCms->variables['page_name'];
$currentNode = &$manager->sureGetNodeByAlias($thisPage);

$nodes = $currentNode->getChildren();

if ($currentNode->hasChildren()) {
echo '<ul class="subMenu">';
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>";
}

Re: How to print one page section in website?

Posted: Fri Oct 07, 2011 6:46 pm
by Dr.CSS
Try {menu start_level='2'} and it will give a link list of all child pages of current page, if you want the parent page menu text above it you will need to install CGSimplesmarty module and read it's help...