Forum

Thread tagged as: Problem, Configuration

Navigation not picking up sub folder

Hi

Using following nav array on 2 pages

<?php perch_pages_navigation(array(
                  'include-parent' => true,
                  'from-path'=> '*',
                  'from-level'=>  1,
                  'template'  => array('side-nav-item.html', 'side-nav-2.html'),

              )); ?>

Have a folder structure:- restaurant index.php menus index.php breakfast-menu.php

On menus/index.php page it shows sub-page in list and parent when sub-page is accessed. On restaurant/index.php nothing is listed.

Have tried changing from-level and from-path. With '*' nothing is listed regardless of level set. When path is /restaurant with level 1 or 2 all non hidden page links are listed regardless of where they are saved.

Have also tried from-path /restaurant/menus with similar results. Not sure what doing wrong or what to try next!

Rob Willox

Rob Willox 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't really understand your structure. Which are the child pages?

Did try on first post to show the dir structure but didn't maintain it so

Restaurant (top level)
           index.php
     Menus (sub-folder)
                 index.php
                 breakfast-menu.php

Can be seen here (dev site): https://webmedia.webhop.biz

Menus page shows child (breakfast-menu.php) and parent on child page.

Restaurant page has

<?php perch_pages_navigation(array(
                  'include-parent' => true,
                  'from-path'=> '/restaurant',
                  'from-level'=>  1,
                  'template'  => array('side-nav-item.html', 'side-nav-2.html'),

              )); ?>

With from-path => '*' nothing shows, with above, all non-hidden pages show.

Update:

Added a subpage to restaurant folder but appeared to make no difference. The only difference is that the parent page is set to 'hide from main navigation'.

If that is unticked the child page appears. Appears the child pages only show if the parent page is not hidden from main navigation.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's right - we can't show a child without its parent if you're asking for the parent to also be included.

If you need a custom navigation structure, consider using a navigation group.

That's ok, don't necessarily need the parent to show.

Can a second navigation array be added to page and specify a different from-path eg /restaurant/menus?

<?php perch_pages_navigation(array(
                  'include-parent' => false,
                  'from-path'=> '/restaurant/menus',
                  'from-level'=>  1,
                  'template'  => array('side-nav-item.html', 'side-nav-2.html'),

              )); ?>

Just tried and menu shows but not the menus child pages. All the non hidden pages show.

Is it simpler to use a navigation group for this as well?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It may be simpler. There's also an option to show hidden pages if you want to go that route.

Done that and working ok.

The question is more why is the named from-path => '/restaurant' not showing same output as the '*' option?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's hard to say without being able to see it, really.