Forum
Get perch_item_count from other regions
Is there a way to get the perch_item_count for a region outside of the region itself.
I have a div that contains 2 perch regions, 'text' and 'gallery' - I wish to count the number of times in the gallery and add it as css to the parent div.
The perch_item_count returns 2, as it is counting the direct children (text and gallery), is there a way to specify what region the count is drawn from?
Hi Tony, that should be possible. Can you show your page and template code?
Ideally I want the count of the pageGallery to be interred into the class declaration of the parent textBlock e.g.:
Thanks
Hi, with a bit of a re-jig we can do it like this:
Basically, we're calling the Repeater earlier in the template to get the count in the DIV class but suppressing the image and alt, then using the Repeater later in the template where we want to output the image gallery.
Awesome. Works perfectly.
Cool :)