Search code examples
templatesresourcesmodxtelevision

ModX: Using GetResources to display multiple pages in one page


I am trying to use getResources to display multiple resources withing one resource, including their Templates and TVs.

The code I have in the page I want to display them is:

[[!getResources? &parents=`50` &sortdir=`ASC` &sortby=`menuindex` &limit=`100` &includeTVs=`1` &processTVs=`1` &tpl=`gigtemp` ]]

Where &tpl=gigtemp is a chunk I have created where all my template HTML and TVs are.

However, nothing is showing on the page.

Can anyone help me out?

Please let me know if I need to explain more.

Update:

Some of the info is showing, but a lot of the html is broken.

My HTML on the Chunk is:

<div class="gig-guide">
<div class="gig-info">
<h2>[[+tv.gigname]]</h2>
<strong>[[=tv.gigcity]]</strong>
<img src="[[+tv.gigthumb]]" alt="Contra Clave Contra Event: [[+tv.gigname]" /></div>
<div class="gig-info">
<h2>[[+tv.gigdate]]</h2>
[[+tv.gigtime]]</div>
<div class="gig-info">
<h2>[[+tv.gigvenue]]</h2>
[[+tv.gigaddress]]</div>
<div class="gig-info">
<h2>[[+tv.gigcost]]</h2>
</div>
<div class="gig-bottom">
<div class="fb-like" data-href="[[+tv.gigfbevent]]" data-send="false" data-width="300" data-colorscheme="dark" data-show-faces="false"> </div>
<div class="gigsocialmedia"><a href="[[+tv.gigbandfb]]" target="_blank"><img src="assets/images/ccc-fb.png" alt="This event on Facebook" /></a> <a class="twitter-share-button" href="https://twitter.com/share?text=[[+tv.gigtwitter]]" target="_blank" data-lang="en"><img src="assets/images/ccc-twiter.png" alt="Tweet this event" /></a> <a href="mailto:?subject=[[+tv.gigemail]]"><img src="assets/images/ccc-email.png" alt="Email this event to a friend" /></a></div>
</div>
<!--END GIG BOTTOM DIV-->
<!--END GIG GUIDE DIV-->

Again, any help is appreciated!


Solution

  • Your code is valid and as far as I can see, without errors. That means that there is something else wrong, I would guess one of the following:

    • You have not cleared your cache, which is not necessary but could solve weird problems
    • The children of resource 50 is not published or is hidden
    • There is something else wrong around your code, making Modx not parsing it correctly.

    Edit: You had several errors in your chunk. Try replacing it with this:

    <div class="gig-guide">
    <div class="gig-info">
    <h2>[[+tv.gigname]]</h2>
    <strong>[[+tv.gigcity]]</strong>
    <img src="[[+tv.gigthumb]]" alt="Contra Clave Contra Event: [[+tv.gigname]]" /></div>
    <div class="gig-info">
    <h2>[[+tv.gigdate]]</h2>
    [[+tv.gigtime]]</div>
    <div class="gig-info">
    <h2>[[+tv.gigvenue]]</h2>
    [[+tv.gigaddress]]</div>
    <div class="gig-info">
    <h2>[[+tv.gigcost]]</h2>
    </div>
    <div class="gig-bottom">
    <div class="fb-like" data-href="[[+tv.gigfbevent]]" data-send="false" data-width="300" data-colorscheme="dark" data-show-faces="false"> </div>
    <div class="gigsocialmedia"><a href="[[+tv.gigbandfb]]" target="_blank"><img src="assets/images/ccc-fb.png" alt="This event on Facebook" /></a> <a class="twitter-share-button" href="https://twitter.com/share?text=[[+tv.gigtwitter]]" target="_blank" data-lang="en"><img src="assets/images/ccc-twiter.png" alt="Tweet this event" /></a> <a href="mailto:?subject=[[+tv.gigemail]]"><img src="assets/images/ccc-email.png" alt="Email this event to a friend" /></a></div>
    </div>
    <!--END GIG BOTTOM DIV-->
    <!--END GIG GUIDE DIV-->