Forum

Thread tagged as: Question

Navigation display from subfolder

I would like to display all links shown in /aktuelleprojekter

Shouldn't this be the write code?

            <?php 
                perch_pages_navigation(array(
                    'from-path'            => '/aktuelleprojekter',
                    'levels'               => 2,
                    'hide-extensions'      => false,
                    'template'             => 'item.html',
                ));
            ?>

Cheers, Simon

Simon Rothenborg

Simon Rothenborg 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have a page defined as /aktuelleprojekter ?

No i have 3 pages:

sektorforskydning.php forsyningssektoren.php erhvervsbeskatningsudvalg.php

I want to display as a submenu. See attached screenshot.

https://www.dropbox.com/s/uc37wr5m4xb9rzb/perch.png?dl=0

Drew McLellan

Drew McLellan 2638 points
Perch Support

The from-path option needs to specify an existing page for Perch to find its descendants.

So how is the way to do it :)

Place the files in a folder called /aktuelleprojekter

And place all the files there?

And make the code like:

  <?php 
                perch_pages_navigation(array(
                    'from-path'            => '/aktuelleprojekter/sektorforskydning.php',
                    'levels'               => 2,
                    'hide-extensions'      => false,
                    'template'             => 'item.html',
                ));
            ?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

It's nothing to do with the files, but the page tree structure. Give the name of the parent page in the tree.

I've read the docs and found this topic, while trying to implement a navigation with the 'from-path' setting.

And want to share in my case:

  • it only seems to work with the .php file suffix. (perhaps because of my local Mamp environment)

  • and because of Drew's post above I was a bit unsure, if I should enter only the parent page name (from the page tree in the admin panel) or the real path to the file.

So maybe the example in the docs could be improved with a full path to a file, just a suggestion.

P.s. Thanks for the wonderful documentation and all the useful tutorials by the way!

My working code looks like this:

<?php perch_pages_navigation(array(
 'from-path' => '/de/index.php',
'levels'    => 2
));