Forum

Thread tagged as: Question

Printing sub page region with navigation template

I have a navigation template on a perch page:

`<?php
            perch_pages_navigation(
                array(
                    'from-path' => '*',
                    'levels' => '1',
                    'template' => array('collections-list.html'),
                )
            );
?>`

This navigation template needs to print a content region from each sub page similar to the way it print the link i.e

<perch:pages id="pagePath" />

doing something like this

<perch:pages id="myRegion" />

or this

<perch:content id="myRegion" />

Any ideas why this doesn't work and what am I doing wrong?

Thanks in advance

Darren Cusdin

Darren Cusdin 0 points

  • 2 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Darren,

If you want to print/return a region, you need to use perch_content() or perch_content_custom(). The function perch_pages_navigation() doesn't return the regions of each page.

If you want to see what's available to you when you use perch_pages_navigation(), you can use perch:showall: https://docs.grabaperch.com/templates/show-all/

thanks Hussien... the :showall function is helpful

How would I setup a perch_content_custom() to return my wanted child values?

Do I simply create an new custom content template? I have seen a few references to using 'page' => '/the-parent-page/*' within the function array how is this implemented like this maybe?

<?php 
perch_content_custom('Collections List', array(
'template' => '_newTemplate.html',
'page' => '/the-parent-page/*'
));
?>

If this is the correct how do I structure template would it be similar to a navigation template i.e

<perch:before>
        <div class="col">
</perch:before>

<div>each child page content value is: <perch:pages id="myRegion" /></div>

<perch:after>
        </div>
</perch:after>