Forum
Using multiple filters for perch_gallery_albums()
I'm on the latest version of Perch and the Gallery add-on.
I need to use multiple filters for the album listing. This is what I have so far:
perch_gallery_albums(array(
'template' => 'album-listing.html',
'image' => true,
'filter' => 'excludeWeb',
'match' => 'neq',
'value' => 'excludeWeb'
));
And it works perfectly. But when I change it to the following, the filter doesn't work anymore, and it's showing all albums:
perch_gallery_albums(array(
'template' => 'album-listing.html',
'image' => true,
'filter' => array(
array(
'filter' => 'excludeWeb',
'match' => 'eq',
'value' => 'excludeWeb'
)
)
));
Are multiple filters not possible for this function, or am I doing something wrong?
Thanks!
The Gallery app predates multiple filters - you can only use one.
Thanks for the heads-up. Can you think of any workaround? We have two different types of albums and need to display two separate lists.
What other factor do you need to filter on?
Ah, sorry.
The other factor would be "Exclude from Web". We have different channels for the galleries (website and mobile app), and some need to be displayed on the mobile app only.
So the filters are:
I think the workaround would be to filter the "exclude from web" attribute within the template.
This works, but then I'm having a problem with the "perch:every" tag, as the "exclude from web" items are still counted as children but are not displayed, messing up my row alignment. Have a look at the following (simplified) example:
For example if the 4th item is an "exclude from web" item it won't be displayed, but the 5th item will be displayed in a new row, leaving the preceding row with only 3 items (since the 4th one is an "exclude from web" item), messing up the grid display.
Any ideas for a fix?
I can't think of a way around that.