Hi
does anyone know how to configure an asset listing to only show assets that have a metadata field set to a particular value?
eg if there are 100 assets in a folder and I only want to display the 15 that have a the colour metadata field set to blue - is this possible?
thanks
Tim
There isnt a built in way to do this, but it could be accomplished easily with JavaScript.
Or use a keyword modifier to check if the value of the metadata field is empty. If it is then have it write some CSS to hide that div.
Or I think the best way would be to use a paint layout with with a conditional keyword. Use a regex to check for the blue string.
[quote]
There isnt a built in way to do this, but it could be accomplished easily with JavaScript.
Or use a keyword modifier to check if the value of the metadata field is empty. If it is then have it write some CSS to hide that div.
Or I think the best way would be to use a paint layout with with a conditional keyword. Use a regex to check for the blue string.
[/quote]
Great thanks Nic
I'll try out the paint layout option
last time I tried to do something similar I couldn't work out how to apply a paint layout to an asset listing
so I applied a paint layout to a folder instead - to show the contents of that folder - but had trouble with that too ie I couldn't get the items to display.
I could only get content to display that was in the page contents of that asset listing
I double checked everything like the asset types that it was set to display and I was only using the default format to make things simple
Any ideas?
thanks
[quote]
last time I tried to do something similar I couldn't work out how to apply a paint layout to an asset listing
so I applied a paint layout to a folder instead - to show the contents of that folder - but had trouble with that too ie I couldn't get the items to display.
[/quote]
All you need to do is apply the paint layout to the asset list. Then, put the %asset_contents% keyword into the type format div, which allows it to use the paint layout. Next, customize the paint layout for your asset type and edit the type format div. Everything should now be set up and the paint layout type format should be controlling what the asset listing displays.
The best option would be to use a stored search. Using paint layouts can mess up your pagination.
So, instead of using an asset listing you use a search page. You define a new search field which points to the metadata field. On the details screen of your search page, scroll down to stored search section, select your new field in the parameter and set value for the source to whatever you need the metadata field to be equal to. Set the show result option to yes.
This will actually only bring back the assets that match on the metadata field value.
On the other point with using paintlayouts, in the type format of each result you can use %asset_content_paint_xxx%, where xxx is the id of your paintlayout. On the paintlayout itself, you can define a condition which will only output content if the condition is met. The problem with this approach is, that if you are using pagination with let's say 10 items per page, then you will get inconsistent number of results one each page. The asset listing will still be aware of all the assets and you would literally be hiding unwanted ones via your paintlayout. Using a stored search gets around this issue.
Thanks,
Anton.