Conditions on snippets/content containers


(Mark Graham) #1

Matrix Version: 5.3.4.2

Hi,

I’m having a little trouble understanding how conditions work at the content container level.

I’m trying to build a JSON feed of some news assets, however we’ve used a snippet to embed a disqus feed on the bottom. I was hoping that I could use an asset condition on that snippet to hide it if the global assetid is the same as the feed’s asset listing.

Content Conatiner:

Condition:

I want the snippet to be hidden when the assetid = 210231, otherwise it’s always shown.

I’ve tested my logical condition in the asset, and it resolves to what I expect (true), but when it’s set as the condition, nothing happens. I’ve tried the %begin_% %end_% keywords also with no effect.

Any help/ideas/assistance would be greatly appreciated!


(Bart Banda) #2

Hmmm, not sure I quite understand the requirement here.

Are you wanting to not list the current front-end asset in an asset listing, but list all others?

What does the disqus feed have to do with the asset listing?

Can you share some more info/context of what you are trying to achieve, and what assets you are using together, ie, are you using a Paint Layout for any of this?


(Mark Graham) #3

Thanks for getting back to me!

I have a whole bunch of news assets that are used in a couple of different areas of our site. I’m trying to create an API using an asset listing that lists all of them as one big aggregate, however some of the news assets have snippets in the asset_attribute_description (specifically a disqus embed which includes JS). I had hoped that I could put a condition on the snippet itself to force it not to print if the globals ID was that of the asset listing I’m using as the API.

I’m pulling individual pieces of information using the standard news asset keywords, and the snippet is in the description text. Perhaps that’s why the conditions aren’t working, because I’m using asset_attribute_description rather than asset_contents?


(Bart Banda) #4

Ah, I get ya now. Interesting.

Any chance you could pull those snippets out of the news items and and include the disqus embed code using a paint layout?

The other alternative is to simply pass a query string to the asset listing, such as “?disqus=false” and then do a conditional check on that inside the snippet code, for example:

%begin_globals_get_disqus^neq:false%
   //embed code
%end_globals%

Could that work?


(Mark Graham) #5

Thanks again for getting back to me!

Paint layout is a possibility, but given the large volume of news assets we already have, we don’t really want to go down that route as it will mean a significant amount of editing for some users.

I had originally thought about using the query string method you suggested, but was attempting to get around use of query strings if possible. I’ve implemented the query string in the meantime, and we’ll see if we come across and complications.

Thanks for you help!


(Bart Banda) #6

You could also do a conditional check on the referral URL?

%globals_page_referrer%