modxmodx-evolutiondittomodx-chunks

ModX: Display multiple pages on one page -How to implement


I understand I am meant to use Ditto to do this but am unsure where to go from there.

Currently, I have a Template with all my TVs on it along with several pages using the template that are stored under a parent. The Ditto code I am using is:

[!Ditto? &parents=`173`&orderBy=`createdon ASC` &tpl=`showtemp` &display=`100` &total=`100`!]

However, when I view the page I get the error:

&tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.

My chucnk ('showtemp') looks like:

<div class="showmedia">
[*showmedia*]
</div>
<div class="showright">
<h2>[*showname*]</h2>
<h2>[*showtime*]</h2>
</div>

As far as the set up goes I am not sure if I am going about it right.

Do I make a Chunk as if it were a normal template with TVs, then replicate it as a proper template, create the resources and go from there?

If someone could give me a step by step on how to do this correctly I would be very grateful! Thanks


Solution

  • You're getting that error message because your placeholder syntax is incorrect in this context.

    [*templateVariable*] is correct for displaying the current resource's TVs, but in a chunk to be used within a snippet loop such as in Ditto you need to format them as placeholders like this: [+templateVariable+]

    I would recommend going through each step in the following tutorial, it will help you understand all the MODX fundamentals:

    http://codingpad.maryspad.com/2009/03/28/building-a-website-with-modx-for-newbies-part-1-introduction/