We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Runway

Rendering templates

I am using skip-template option on perch_pages_navigation() and I am returned an associative array.

I do some work on the data, then I would like to render the navigation with my new array. If I use...

perch_template('navigation/item.html', $results)

the template is rendered, but because the template is perch:pages I don't get the data from the array.

Is there a way to tell perch_template() which scope the tags are in.

Otherwise, is there another way to do this? If I duplicate the template and change the tags to perch:content then I get the results I expect. But this means maintaining (2) templates if I want to re-process the array into the template.

Robert Ketter

Robert Ketter 103 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There's not currently, but there should be. I'll look at adding it.

Drew McLellan said:

There's not currently, but there should be. I'll look at adding it.

Well that would be awesome. For now I am using this workaround...

I created my template with perch:content tags then named it with the following convention...

(name.scope.extension) ie: item.content.html

then created another as (name.extension) ie: item.html

which contains ONLY the following code...

<perch:template path="navigation/rks/item.content.html" rescope="parent" />

Now, I am able to use the templates rescoped to parent, and perch_templates() processes the template too because its got the perch:content tags it was expecting.