Forum

Thread tagged as: Question, Suggestions

Use a variable in a conditional tag

Is it possible to use a variable in a conditional tag? It doesn't seem to work for me but maybe it does?

<perch:if id="product" value="eq" match="<perch:content id="productlink" />">

Ken Wuytack

Ken Wuytack 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You have match and value the wrong way around, so you'll need to swap those. To use a variable, wrap it in {braces} like this:

<perch:if id="product" match="eq" value="{productlink}">

That was just a mistake while giving an example of the code. But I couldn't find an example in the docs with the variable wrapped in braces to use in a conditional tag.

But works great! Thanks!