I haven’t tried this on a live server, but I’m assuming it shouldn’t work any differently. I just installed ModX, setup my templates, template variables and chunks, created child pages within a parent page and now want to display those child pages in a list on the parent page. Literally, what I’m doing is allowing the addition of locations for a restaurant chain by having the title be the name of the location, the content being the address and other contact info, and custom TVs for a location image, a map link and a site link. I’ve created the Ditto template (as a chunk) and named it location. The contents are as follows:
<li>
<img src="[+location_image+]" alt="[+pagetitle+]" />
<div class="details">
<h2>[+pagetitle+]</h2>
[+content+]
<p><a href="[~[+map_link+]~]">Maps & Directions</a><br />
<a href="[~[+location_site+]~]">Visit the website</a></p>
</div>
</li>
The page’s template has a Ditto call that looks like this:
[[Ditto? &parents=`47` &depth=`0` &display=`all` &sortBy=`createdon DESC` &tpl=`location`]]
This isn’t outputting anything, despite there being three pages within the ID of 47. I’ve tried simplifying this as much as possible to see if it will get the child pages at all by using
[[Ditto? &parents=`47` &display=`all`]]
and that outputs the same thing (No documents found). What’s going on here? The only thing I can think of is that the ID is wrong, however when you are in the admin area, the left frame shows the locations page with a number 47 in parenthesis, and the three locations appear as children. Additionally, I can enter localhost/?id=47 and I see a page with the locations template being used.