Thread tagged as: Problem, Runway

Section navigation

I want to display the navigation just for the section I am in. The from-path seems to be ignored. The navigation shows all the pages from the site. I just want the ones from the section I am in. If I view the company section or sub page I set have the from-path to '*' or '/company' but it shows the pages from all sections not just the company section.

    'from-path' => '*',
    'from-level' => 1,
    'levels' => 0,
    'hide-extensions' => false,
    'hide-default-doc' => true,
    'flat' => false,
    'template' => array('level1.html', 'level2.html'),
    'include-parent' => false,
    'skip-template' => false,
    'siblings' => true,
    'only-expand-selected' => true,
    'add-trailing-slash' => false,
    'navgroup' => false,
    'include-hidden' => false,
Martin Elliff

Martin Elliff 0 points

  • 5 years ago
Simon Clay

Simon Clay 127 points

Hi Martin,

I think these are the options you'd use to achieve this:

    'from-path'            => '*',
    'template' => array('level1.html', 'level2.html'),
    'siblings'             => true,
    'levels'               => 1,

No same problem, no difference. It shows all the top level pages not just the section I am on; i.e. it shows Section 1 -- Sub page of section 1 -- Another sub page of section 1 Section 2 Section 3 Section 4 Section 5. If I am on Section 1 or a sub page I only want to see that part of the navigation. I want to see only; Section 1 -- Sub page of section 1 -- Another sub page of section 1

Simon Clay

Simon Clay 127 points

I'm wondering whether this is to do with Runway routing.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried the example from the documentation?


That does not show the siblings but still has the same problem in that if on the section page it shows all the sections.

Is this the same problem as the breadcrumb? Should the sections be on the root and not under the homepage in the hierarchy?

Previously I have had to pull out the section page separately to its sub pages e.g. $section_navigation = perch_pages_navigation(array( 'from-path' => '', 'from-level' => 2, 'levels' => 1, 'include-parent' => true, 'skip-template' => true )); print '<nav> <a href="' . $section_navigation[0][pagePath] . '" title="' . $section_navigation[0][pageTitle] . '">' . $section_navigation[0][pageNavText] . "</a>"; perch_pages_navigation(array( 'from-path' => '', 'from-level' => 2, 'only-expand-selected' => true )); Is there no way to have this work as desired natively?

I have moved the sections to the root on the same level as the home page and modified the above to get what I need. I was hoping it could be done in the navigation function but is only a little more code. $sectionNavigation = perch_pages_navigation(array('from-path' => '*', 'from-level' => 1, 'levels' => 1, 'include-parent' => true, 'skip-template' => true)); print '<ul id="sub-nav" class="list-unstyled"> <li><a href="' . $sectionNavigation[0]['pagePath'] . '" title="' . $sectionNavigation[0]['pageTitle'] . '">' . $sectionNavigation[0]['pageNavText'] . '</a>' . PHP_EOL; perch_pages_navigation(array('from-path' => $sectionNavigation[0]['pagePath'], 'from-level' => 2, 'template' => array('level2.html', 'level2.html'), 'only-expand-selected' => true)); print '</li> </ul>';