Forum

Thread tagged as: Question, Suggestions

Backend rendering of templates

Sometimes, it would be useful to be able to render a template in the perch backend as well. Here's a use case:

On our portfolio site, I am creating a record for each project. Now I would like to use Perch as a hub for all project-related data - also some data that shouldn't appear in the frontend at all.

This could be very easily done in the frontend or in a "members" protected area of the frontend. But it would make more sense right in the backend.

Like a clickable link to the related harvest project. Or even pull in some API data, say, from Google Analytics.

Even, templates rendered in the backend could be used to create tiny preview bits in the backend, e.g. when heavily using microdata.

<perch:content id="harvestLink" type="template" template="link.html" />

or

<perch:content id="ingredientsPreview" type="template" template="ingredients.html" />

Brilliant! :-)

What do you think?

Urs Bräm

Urs Bräm 1 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm a bit confused! What would this do? Show the output, or pull in the edit fields?

Show the rendered output of a (partial) template in the backend. I've made an example for one of the use cases:

The backend template for that item:

<perch:content id="harvest_id" type="text" label="Harvest Project ID" />
<perch:content id="harvestLink" type="template" template="link.html" />

I tend to split split them up into FE and BE, so I don't need to use suppress="true".

then link.html:

 <a href="https://user.harvestapp.com/projects/<perch:content id="harvest_id" />/edit">View this project in Harvest</a>

https://dl.dropboxusercontent.com/u/11320047/backend-rendering.png

Heard about your shoulder. Get well soon!

Drew McLellan

Drew McLellan 2638 points
Perch Support

I see what you mean - I'll give it some thought!