Jump to content

MarkupSimpleNavigation Menu Showing Children of Current Page - How?


webweaver
 Share

Recommended Posts

I know this must be simple, but I'm having a heck of a time trying to figure this out.

I want to add a menu into a page that shows the children of that page. In other words, this page is just a container page of the sub pages and I want to display those sub pages as a menu inside the current page.

Please Help

Link to comment
Share on other sites

Soma, I was trying to do that but couldn't figure out exactly how - I'm still pretty new at this :(

For example, I tried this with no success:

<?php $treeMenu = $modules->get("MarkupSimpleNavigation");
$rootPage = $page;
        $options = array(
    'parent_class' => 'parent',
    'current_class' => 'current-menu-item',
    'has_children_class' => '',
    'levels' => false,
    'levels_prefix' => '',
    'max_levels' => 2,
    'firstlast' => false,
    'collapsed' => false,
    'show_root' => false,
    'selector' => '',
    'selector_field' => 'nav_selector',
    'outer_tpl' => '<ul class="dl-menu">||</ul>',
    'inner_tpl' => '<ul class="dl-submenu">||</ul>',
    'list_tpl' => '<li%s>||</li>',
    'list_field_class' => '',
    'item_tpl' => '<a href="{url}">{title}</a>',
    'item_current_tpl' => '<a href="{url}">{title}</a>',
    'xtemplates' => '',
    'xitem_tpl' => '<a href="/{url}">{title}</a>',
    'xitem_current_tpl' => '<a href="/{url}">{title}</a>'
    );
    echo $treeMenu->render($options,$rootPage);
    ?>
 
Link to comment
Share on other sites

Just to make it complete with a working example (now at desktop):

$treeMenu = $modules->get("MarkupSimpleNavigation");
$rootPage = $page;

$options = array(
    'current_class' => 'current-menu-item',
    'has_children_class' => '',
    'max_levels' => 2,
    'outer_tpl' => '<ul class="dl-menu">||</ul>',
    'inner_tpl' => '<ul class="dl-submenu">||</ul>',
    'item_tpl' => '<a href="{url}">{title}</a>',
    'item_current_tpl' => '<a href="{url}">{title}</a>',
);

echo $treeMenu->render($options, null, $rootPage);
Link to comment
Share on other sites

@Soma: feature request :-)

Remove Indentation, not rendering tabs newlines & other unnecessary white-space characters.

Lot's of time, ill remove them with regex, but hey, i'm lazy...

Not the right thread but I hear you.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...