@INHERIT half broken on some pages

We have a weird situation on this page related to @INHERIT somehow causing a weird effect where some of the page icons being pulled in by getResources, don’t fill in.

After August 4th we changed the template variable to have a default value of @inherit for the field handling the page thumbnails. Theoretically it should pull in the parent icon, making it easier to setup a matching series.

The August 4th page had the image manually chosen before we setup the @inherit. All other pages, August 11, 18, 25th, were created with @inherit as default. One out of three works like it should.

If I look at them in the back end all four of these August pages have the exact same URL filled into the corresponding TV. But, if I look at the source in Chrome or Firefox it is showing a value of @INHERIT for the pages missing their icons.

I even took the August 11th page and deleted the URL to the icon image, saved the page, then manually opened the page and chose the image. No change.

I also cleared the cache and refreshed the URIs. pThumb is resizing the source image, in case that helps give any ideas.

Anyone know how I can get MODx to act right?

1 Like

Does it help if you save the resources?

What do you mean by “save the resources”?

All four of them have been saved, hence why they exist as items on the website. Unless you mean something out of the ordinary.

Did you watch the console in your browser when loading the broken pages? There should be some errors I would think

Taking a look, you’ve got quite a lot of warnings like this, other ones two but a bunch like this

Unknown property ‘-moz-border-radius-topleft-radius’. Declaration dropped.

you’ve also got some kind of jquery error as well

-moz-border-radius is a css style for older versions of Firefox. I can’t imagine that being the issue since it is on every page for the last 4 years and hasn’t caused a problem until we added @inherit to the template variable pulling in the icon. I fixed that jquery error too, but that didn’t seem to help anything.

The only error I see otherwise is the 404 where the page can’t load the URL called @inherit, which is the image file. It’s as if MODx isn’t filling in the @inherit variable on just two of the 4 icons on that page.

The icons on that page are built by the getResources snippet.

MODx v2.7.1
getResources v1.6.1
pThumb v2.3.3.

Something new…

Some background, most of these pages have the date as their resource alias in the form of 2018-08-25 while the page title might be August 25, 2018. A few minutes ago I realized that August 18, 2019 had been auto filled by MODx so the alias read August 18, 2019. I changed it to match the pattern we normally use and this caused the icon for that page to disappear from the getResources call.

August 18th is now behaving like the others in the parent view.

What in the world does the resource URL have to do with how MODx applies the @INHERIT command to a template variable? Weird.

Furthermore if I remove @inherit from the default TV input and look at those resources again the TV field becomes empty. If I add @inherit back the TV field fills in with the parent (just as expected). But, for whatever reason getResources or possibly pThumb are never seeing the data. If Chrome inspector is to be believed @inherit is being passed right through to Chrome to use as the image source.

I think I figured out the problem. getResources needs to have &processTVs in order to run through the @inherit command. &includeTVs isn’t enough on it’s own like it was when the TV data was static.

1 Like