Forum
If region has items ?
Hi.
Trying to figure out how to check whether a region has items. If it does then display it otherwise hide that section of html.
Is there any way of saying
if region(‘testimonals’).count = 0 hide block ?
Hi.
Trying to figure out how to check whether a region has items. If it does then display it otherwise hide that section of html.
Is there any way of saying
if region(‘testimonals’).count = 0 hide block ?
If a region doesn't have any content it won't display by default.
Yep, but what I've got is a section of html saying "here is a list of our projects" and then after that it displays those projects / regions.
Managed to do it with this:
which returns 0 if the region contains no items which means I can hide and show that block when there's content to show.
There's probably a much better way to do this, any pointers?
Hello John,
I think you can achieve this with:
Put that in the
<perch:before>
section in your template.Excellent!, thanks Hussein