Forum

Thread tagged as: Question

PerchSystem::set_var not working??

OK, so I am successfully using PerchSystem::set_var on one template. In another, it just seems to be ignored. It shows in the template if I use perch:showall.

On the page:

if (perch_get('cat')) {
PerchSystem::set_var('current_category', perch_get('cat').'/');
}

Within the image tag on in the template:

<perch:if id="{current_category}" match="eq" value="service/flowers/">src="<perch:content id="thumbFlowers" type="image" width="622" height="622" crop="true" quality="65" />"</perch:if>

I have made sure the value matches that which shows with perch:showall, but the image tag is output without the src. Where have I gone wrong is the problem? I had a similar issue with the template where this DOES work, but it suddenly seemed to start working and I don't know what I did differently!

Lisa Morena

Lisa Morena 1 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

id="{current_category}" should be id="current_category"

ahhhhhh, will try that then - thanks!

Yep, that did it - thanks!

Drew McLellan

Drew McLellan 2638 points
Perch Support

The {braces} mean "the value of" - so for your case that would have been the same as using id="service/flowers/". No field with that ID exists, obviously.