Forum

Thread tagged as: Question

How to re-use a template

I need a client to be able to re-use a template in 2 or more places on the website, without having to repeat the process of adding the content again each time. So they can add the content to the template and then somehow, elsewhere, select it again to tell it to also appear in a different place.

How can this be achieved? Just using regular Perch, not runway

Chris James

Chris James 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Sure, you can use perch_content_custom() to redisplay a region from another page:

https://docs.grabaperch.com/docs/content/perch-content-custom/

Thanks Drew Ive got that working. Now one more problem....

Now I'm trying to figure out how to alternate the output of 2 different templates the client has added content for, so the output comes out in a grid, like this

A B A  
B A B
A B A

...regardless of what what order they added template content.

Thanks

Is it pulling from one region? If so you could do something like

<perch:every nth-child="odd">
    <perch:template path="template1.html" />
<perch:else />
    <perch:template path="template2.html" />
</perch:every>