Forum

Thread tagged as: Question, Problem, Docs

Separate Navigation Blocks

Hi I would like to create a website with the three navigation blocks. The first block would be in the header and only show the level 0 of the navigation tree. Then I got another block showing the corresponding level 1 childs. The I got another block e.g. on the right side showing the corresponding level 2 childs.

So when you arrive on the index page, you only see level 0. E.g Services, About us, Contact Then you select Services. On the services page you still see the level 0 + all level 1 childs (e.g. webdesign, hosting etc.) from services in a separate block. The you select Webdesign and you will see all child pages from webdesign in a seperate nav block.

The first two navigation blocks work as expected. But the third block (level 2) is also showing the level 1 navigation if I'm on level 1 (e.g. Services). But it should only show the level 2 childs.

I hope you understand my problem :-)

Patrik Dummermuth

Patrik Dummermuth 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us the code that isn't working?

Sure:

For the first nav block i got:

perch_pages_navigation(array('levels' => 1));

For the second i got:

perch_pages_navigation(array(
    'from-path' => '*',
    'from-level' => 1,
    'levels' => 1,
    'only-expand-selected' => true,
)); 

And for the third one (which doesn't work correctly)

perch_pages_navigation(array(
    'from-path' => '*',
    'from-level' => 2,
    'only-expand-selected' => true,
)); 
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it make a difference if you set from-level to 3 ?

Nope. Makes no difference

Drew McLellan

Drew McLellan 2638 points
Perch Support

How about the only-expand-selected option?

Nope. Makes no difference

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post a screen shot of your site tree?

I set up a demo page with my navigation problem: https://liturgie-perch.suupa.net/

When you navigate to https://liturgie-perch.suupa.net/liturgiekommission/ : - Level 2 shouldn't show any childs unless you are on https://liturgie-perch.suupa.net/liturgiekommission/orientierung/

When you navigate to https://liturgie-perch.suupa.net/liturgiekommission/orientierung/ : - Level 1 should still show "Orientierung" instead of the child "Grundsatztexte" - Level 2 should show all Childs from "Orientierung"

I hope you can help me with my problem.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you still running the same version of the software you were using 8 months ago?

No I upgraded to Perch 2.8

Drew McLellan

Drew McLellan 2638 points
Perch Support

What code are you using for the two bottom examples (L1 and L2) ?

<?php perch_pages_navigation(array(
            'from-path'           => '*',
            'levels'              =>1,
 )); ?>

and

<?php perch_pages_navigation(array(
            'from-path'           => '*',
            'from-level'           => 2,
            'only-expand-selected' => true,
          )); ?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think what I'm going to need to do is duplicate your structure and try it out, because I'm struggling to follow and knowing what to suggest.

Can you give me a screenshot of your expanded pages list as it currently stands?