Forum
Using Perch If with Categories
Hi
Is it possible to use conditionals in templates using Perch categories?
For example:
<perch:categories id="testCat" set="cats">
<perch:if exists="catTitle" value="category1">
-- Show alternate content
</perch:if>
</perch:categories>
I know this means embedding knowledge of category titles in the template, but rather than make two calls on the master page to filter by categories, where we have a a list of articles that can be a mixture, the idea is that the template can conditional write specific elements based on this?
Yes - but
exists
only checks if a value is set. Useid
if you want to compare with avalue
.Great, many thanks!