Forum

Thread tagged as: Question

navigation

Can some show me if there is a video or docs on how to set up a top level navigation and a secondary side navigation. I want the client to be able to add pages from a template and these additional pages should appear in a side nav. I have set a template for the page, but I am unsure how to set up the side navigation. Thanks.

Ian Gordon

Ian Gordon 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

To get your top level navigation:

perch_pages_navigation([
    'levels' => 1,
]);

For your second level:

perch_pages_navigation([
    'from-path' => '*',
    'from-level' => 1,
]);

Thanks Drew... I have this

<?php perch_pages_navigation(array('navgroup' => 'sidenav','template'=>'sidenav.html'));?>

I have 'sidenav.html' in the navigation directory, would this be correct? Should the navigation also be shared content?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you need to use a nav group here?

No I suppose... I was thinking that navgroup then defined .. ah so should it be ?

<?php perch_pages_navigation(array('sidenav' ,'template'=>'sidenav.html'));?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, that was right as you had it - if you really need a navigation group. I'm not sure that it's the right tool for the job from what you've described.

Did you try my suggestions?

Thanks Drew, Top Level Works well. The sidenav would contain links to various Projects, so would be new pages created by client from a template. I thought I would need to create a separate template in navigation to accommodate the new pages? Having a rethink on how to do this , thanks for the guidance as always