Forum
Set Label using System Variable
Is it possible to set the label of a content template in the admin area using a system variable? Eg.
<perch:if exists="dynamicLabel">
<perch:content type="textarea" id="pageContent" label="<perch:content id='dynamicLabel'/>" html="true" editor="ckeditor" />
<perch:else />
<perch:content type="textarea" id="pageContent" label="Text" html="true" editor="ckeditor" />
</perch:if>
The if statement works fine, however the label reads "<perch:content id=" and the editor plugin doesn't load.
Not a huge problem if it's not possible, I want to re-use the same template in different scenarios - I just don't want to call every text block "Text".
Add : title=“true” to perch:content tag of the content you want to show as a label in admin listing.
I'm not sure that's the same thing? I want to pass the label name from the php master page into the template:
eg to change the default text block label from 'Text' to 'About You'.
Creating the region in the PHP master page:
Then having the intro.html content template pick up the name to show in the admin area:
I could hard code the target result:
However this would result in multiple templates each with their own label negating the benefit of being able to nest them.
If you look in the documentation that shows how to pass variables into templates.
I'm on top of the method, what I want to know is if variables can be parsed by the admin views in the same way the front end views do?
I'm guessing they cannot?
They cannot.
Thanks Drew.
The Region's name is listed at the top of the edit form. So while you can't change the label dynamically, at least the Region's name can be more meaningful than "Text".
It's not the region Hussein, it's the label of the content within the region.
No problem, just would be a nice feature.
Yeah, I get what you're trying to do. All I'm saying is the name of the region is listed in the edit form which is better than nothing.
A region named 'About me' and a region named 'Intro' can use the same template and the fields in both edit forms would be labelled identically, but at the top of the edit form the editor can see the name of the region they are editing.
Yeah, I used to do it that way, but ended up with lots of regions.
I try to keep the number of regions down to make editing more streamlined. I then re-use the content with different templates.
Thanks for looking at it though.