modxmodx-revolutiongetresourcemodx-chunks

ModX getResources template chunk HTML out of order?


I have a getResources chunk that looks like:

<a href="[[+tv.galimage]]" class="fancybox galitem" title="[[+pagetitle]]">
<div class="galimage" style="background-image: url('[[+tv.galimage]]')"></div>
</a>

but for some reason the first two resources appear with the div outside of the A tags, eg:

<a href="images/Gallery/ferrari1.jpg" class="fancybox galitem" title="Image 2">
</a>
<div class="galimage" style="background-image: url('images/Gallery/ferrari1.jpg')"></div>

Yet every other resource following these first 2 and using the same template chunk appears as expected, eg:

<a href="images/Gallery/porsche.jpg" class="fancybox galitem" title="Image 2">
<div class="galimage" style="background-image: url('images/Gallery/porsche.jpg')"></div>
</a>

Would anyone know why this is occurring and what I could do to fix it?

(Obviously, I have tried clearing the cache. Also, this does not appear to be isolated to a particular resource. It occurs no matter which resources appear first in the list.)


Solution

  • It was a weird issue with wrapping a block element (div) in an inline a tag. Changed div to span and it was ok.