Migx content not loading: Images to separate placeholders

Here’s an example of what I did: Immigration Lawyers | Buchanan Ingersoll & Rooney PC

So my goal here was to create a TV that could hold up to 3 sizes of images for different screen sizes (desktop, table and mobile). But I also set up the TV to allow multiple banner ads with separate placeholders if more than one ad was needed on a page.

For some odd reason, occasionally, the content just doesn’t load and it takes manually re-saving the resource to get it to populate. I’m hoping that someone will spot something wrong with my code to help me diagnose this issue.

In the InlineAdvertisement TV:

[{“caption”:“Advertisements”, “fields”: [

{"field":"AdLarge","caption":"Desktop Size","description":"Larger Size for small to large monitors","inputTVtype":"image","sourceFrom":"migx"},
{"field":"AdMed","caption":"Tablet Size","description":"Medium Size for tablets (optional)","inputTVtype":"image","sourceFrom":"migx"},
{"field":"AdSm","caption":"Mobile Size","description":"Small Size for phones","inputTVtype":"image","sourceFrom":"migx"},
{"field":"AdURL","caption":"Location to Link to","inputTVtype":"text"},
{"field":"AdTracking","caption":"Optional Tracking Code","description":"Starting with qestion mark (?)","inputTVtype":"text"},
{"field":"AdAlt","caption":"Alternate Image Text","inputTVtype":"text"}

]}]

In the Template:

[[*InlineAdvertisement:notempty=`
    [[getImageList? 
        &tvname=`InlineAdvertisement` 
        &tpl=`AdvTpl`
        &toSeparatePlaceholders=`adv`
        &placeholdersKeyField=`idx`
    ]]
`]]

In the Chunk:

<a class="inline-advertisement" href="[[+AdURL]][[+AdTracking:notempty=`[[+AdTracking]]`]]" target="_blank" title="Click Here">
    [[+AdLarge:notempty=`<img class="large" src="[[+AdLarge]]" alt="[[+AdAlt]]" />`]]
    [[+AdMed:notempty=`<img class="tablet" src="[[+AdMed]]" alt="[[+AdAlt]]" />`]]
    [[+AdSm:notempty=`<img class="small" src="[[+AdSm]]" alt="[[+AdAlt]]" />`]]
</a>

Then, the user would just add [[+adv.1]] (or whatever number was next) to some point in the content editor of the page to place the banner.

Any advice would be appreciated.

Thx

In same situation,
I created a Tv with dropdown value for my Advt chunks and I make it like choose from different ads
i.e. ad-1, ad-2, ad-3 and also a default null value for No Ads.
And for different screen sizes, you can use css media queries to hide the same chunk via a css class and that class in media query to hide on desktop or on mobile or tablet.

And on the same chunk you can place 3 images and then they will automatically hide based on their classes.

yeah that’s exactly what I did. But I just used it on few pages yesterday. Now today they are all missing on the front end of the website. But in the editor, it still shows the [[+adv.1]] right where it should be. Resaving the resource brings it back on the front, but I can’t keep doing this every day.

1 Like

Here’s a link to a MIGX tutorial that turns out to be doing the same thing. I don’t know why this isn’t working.
https://docs.modx.com/current/en/extras/migx/migx.tutorials/fancybox-images-with-seperate-placeholders-in-richtext-content

1 Like

did you try without

[[*InlineAdvertisement:notempty=`

getImageList doesn’t output anything, when empty, so this output-filter-thing isn’t needed

1 Like

Of course now they all seem to be working. Next time i use this and see something missing i’ll try it.

So i checked one of them today and it was missing on the front end like before. I even made the change you recommended before the end of the day, that day last week.

The one thing I just tried to do was clearing the cache under the “manage” tab and then it showed back up. I won’t know if that was a fix or not until it happens again. But does that mean anything to you?

thx