Forum

Thread tagged as: Question, Suggestions

Adding/overriding template attributes with template includes

I'm not sure whether this will be a feature request or just something I can't get to work and is already there… I'd like to pass extra attributes into a template include via the perch:template tag. The current use case would be to pass a suppress="true" in a utility introductory paragraph template. So the template would look like

<perch:content id="intro" type="textarea" label="Introduction" size="xs" required="true" count="chars" help="Keep the character count under 200" />

and it would be included something like:

<perch:template path="content/introduction.html" suppress="true" />

So it would be editable in the control panel but not output to the page.

Overriding template attributes would be cool too, so if I added a new help="" attribute to the include it would replace the help text in the template.

Is this currently possible?

Martin Underhill

Martin Underhill 5 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can't pass suppress as a value, because that's a reserved attribute name that Perch already uses.

Ah, ok. Just thought to check. I'll use a similar template with the suppress="true" attribute on it. Cheers :)