How to print one page section in website?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
subbuindesign
New Member
New Member
Posts: 4
Joined: Sun Jan 23, 2011 3:03 pm

How to print one page section in website?

Post 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>";
}
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: How to print one page section in website?

Post 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...
Post Reply

Return to “CMSMS Core”