Forum
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?
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.
We'd welcome any suggestions about making it less fiddly, short of loading all content for the whole site into every template.