Forum
Checking for multiple values with perch:if exists not working
On a website (running the latest version of Perch) I want to display content in English, when the user has chosen English as his/her language AND the content is available in English. Otherwise it should display the German content.
I am trying to accomplish that by doing the following, but it is always showing the German content.
<perch:if exists="english AND heading-en">
<h2><perch:content id="heading-en" type="text" label="Überschrift englisch" /></h2>
<perch:else />
<h2><perch:content id="heading" type="text" label="Überschrift" /></h2>
</perch:if>
If I check for only one value (it doesn't matter which) it is working. So the values are being read just fine. The operator AND seems to break the code, though.
Any ideas are welcome.
Can we see your Diagnostics Report please?
Your
heading-en
ID has a dash in it, which isn't a legal character. Does it work with valid IDs?Huh, that I didn't know.
Problem solved.
Thanks a lot, Rachel and Drew.