We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40122
    • 330 Posts
    I have a getResources chunck 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:

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




    Would anyone know why this is occurring and how to fix? I've tried clearing the cache the deleting the resource with no change. This happens to the 1st 2 resources no matter what they are.

    getResources call if anyones interested:

    [[!getResources? &parents=`122` &tpl=`galtpl` &includeContent=`1` &sortby=`{"menuindex":"ASC"}` &includeTVs=`1`  &limit=`99`]]

    This question has been answered by claytonk. See the first response.

    • discuss.answer
      • 5430
      • 247 Posts
      That is odd. Any chance this is your browser's response to an incorrect doctype? Block elements inside an anchor tag are an HTML5 thing, if you're using an older doctype I suppose it might be possible the browser you're viewing the source with is having trouble parsing your output. That might be reaching, but there's certainly no reason MODX or getResources would be doing this. This is the sort of thing WYSIWYG editors do when cleaning up HTML.
        • 40122
        • 330 Posts
        Quote from: claytonk at Apr 27, 2015, 11:18 AM
        Block elements inside an anchor tag are an HTML5 thing, if you're using an older doctype I suppose it might be possible the browser you're viewing the source with is having trouble parsing your output.

        Yep, you're right. Changed div to span and its happy now.