We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51020
    • 670 Posts
    Hi,

    I have a collection, and each child contains various TVs.

    The Getresources Call I'm using in the template is this:
    <ul class="videogallery">
    [[!getResources?
    &parents=`[[*id]]`
    &tpl=`VideoTpl`
    &showHidden=`1`
    &limit=`100`
    &processTVs=`1`
    &includeTVs=`1`
    &includeTVList=`YouTubeID,YouTubeID2`
    ]]
    </ul>


    The TPL chunk I'm using to render the list of child resources is this:

    [[+tv.YouTubeID2:isempty=`
    <li>
    <a href="http://youtube.com/watch?v=[[+tv.YouTubeID]]&autoplay=1" title="[[+pagetitle]]">
    <div style="background:url(http://img.youtube.com/vi/[[+tv.YouTubeID]]/0.jpg) no-repeat center / cover;"></div>
    <p>[[+publishedon:strtotime:date=`%b %Y`]]</p>
    <h2>[[+longtitle:ellipsis=`27`]]</h2>
    <span><p>Watch:</p><h3>“[[+longtitle]]”</h3></span>
    </a>
    </li>
    `]]
    [[+tv.YouTubeID2:notempty=`
    <li>
    <a href="[[~[[+id]]]]"title="[[+pagetitle]]">
    <div style="background:url(http://img.youtube.com/vi/[[+tv.YouTubeID2]]/0.jpg) no-repeat center / cover;"></div>
    <p>[[+publishedon:strtotime:date=`%b %Y`]]</p>
    <h2>[[+longtitle:ellipsis=`27`]]</h2>
    <span><p>Watch:</p><h3>“[[+longtitle]]”</h3></span>
    </a>
    </li>
    `]]

    So basically it's seeing if I have more than one video (YouTubeID2) - if I do, it renders the second <li> and opens the resource as a page, but if YouTubeID2 is empty, then it open the first video in a modal window. All good so far, although I'm sure the above could be simpler!

    But, for some reason, the contents of YouTubeID2 is being rendered in between my list items, so if I view my source code i can see stray TVs being printed:


    <li>
    <a href="http://youtube.com/watch?v=tamQQ-z12H0&autoplay=1" rel="prettyPhoto" title="GLA Report">
    <div style="background:url(http://img.youtube.com/vi/tamQQ-z12H0/0.jpg) no-repeat center / cover;"></div>
    <p>Feb 2016</p>
    <h2>GLA Report</h2>
    <span><p>Watch:</p><h3>“GLA Report”</h3></span>
    </a>
    </li>


    czkdxpdwBOM <---- stray TV value!!

    <li>
    <a href="media-centre/videos/uber’s-lobbyist-campaign-against-tfl-safety-proposals/" title="Uber’s Lobbyist campaign against TfL safety proposals">
    <div style="background:url(http://img.youtube.com/vi/czkdxpdwBOM/0.jpg) no-repeat center / cover;"></div>
    <p>Feb 2016</p>
    <h2>Uber’s Lobbyist campaign against…</h2>
    <span><p>Watch:</p><h3>“Uber’s Lobbyist campaign against TfL safety proposals”</h3></span>
    </a>
    </li>

    WbkcvXu8sAk <---- stray TV value!!

    <li>
    <a href="media-centre/videos/taxis-banned-from-tottenham-court-road/" title="Taxis Banned From Tottenham Court Road?">
    <div style="background:url(http://img.youtube.com/vi/WbkcvXu8sAk/0.jpg) no-repeat center / cover;"></div>
    <p>Feb 2016</p>
    <h2>Taxis Banned From Tottenham…</h2>
    <span><p>Watch:</p><h3>“Taxis Banned From Tottenham Court Road?”</h3></span>
    </a>
    </li>

    Any ideas why this is being rendered at all?!

    Confused!
    Thanks
    Andy
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Have you tried validating the page? It may be a problem in all of those conditional output blocks.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 51020
        • 670 Posts
        Validate the page how?
        Within modx? Not sure how one does that.

        Thanks
        Andy
          • 28042 ☆ A M B ☆
          • 24,524 Posts
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 51020
            • 670 Posts
            Ha ha sorry - I thought you meant some special Modx validation.
            Yes I've done that - nothing notably wrong.