Forum

Thread tagged as: Question, Gallery

perch:if - Conditional IF from one template to another on the same page?

Hi, just wondering if it's possible to use a perch:if in one content template, that references an ID of another template loading on the same PHP page? Or do they get rendered before the page and thus I can't check for ID value?

Basically, I have a nav of gallery locations that filter a list of gallery items in JS. I want to hide the nav link if no galleries match that location.

If no, can hide in JS I guess?

Stuart Farrell

Stuart Farrell 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can only test for items within the template, but you can pass anything you like into the template using PerchSystem::set_var()

Yeah... that's getting a bit fiddly. We just did it in the JS.

Drew McLellan

Drew McLellan 2638 points
Perch Support

We'd welcome any suggestions about making it less fiddly, short of loading all content for the whole site into every template.