The example tutorial creates an unworking Ditto object.
http://ditto.modxcms.com/tutorials/creating-a-custom-template.html
Step 1
Create a chunk based on following code and note its name. This document will assume you named it DittoTemplate.
Default display template (tpl):
<div class="ditto_item" id="ditto_item_[+id+]"> <h3 class="ditto_pageTitle"><a href="[~[+id+]~]">[+pagetitle+]</a></h3> <div class="ditto_documentInfo">by <strong>[+author+]</strong> on [+date+]</div> <div class="ditto_introText">[+introtext+]</div> </div>
Step 2
Append &tpl=`DittoTemplate` to your snippet call and Ditto will use your custom template
...What is missing from the example? Gotta be something not mentioned because I get "No document found" so obviously the above code makes MODx look for an unavailable document.
-
MODX Staff
- 95 Posts
What does your entire Ditto call look like? [!Ditto? &tpl=`DittoTemplate`!]
The tpl seems to work for me as described in the tutorial.
Yup. [!Ditto? &tpl=`DittoTemplate`!] = No Documents Found.
There must be something additional you are doing that is not in the above directions. Are you creating a new document and somehow linking it to the Ditto chunk or Snippet?
-
MODX Staff
- 95 Posts
Are there published documents under the page/document that you are making the call from? or are you specifying a startID that has multiple pages underneath?
If you change the snippet call to just [!Ditto!] or [[Ditto]] are you still not getting any documents?
Keep in mind I have NO idea how Ditto works, so if there’s something that might not be stated above, I need to know what that step is.
I merely made a chunk as it said in step 1.
And then I added the [!Ditto? &tpl=`DittoTemplate`!] call to my template.
That’s all I did. And this is the only thing I’ve changed on the Minimal default Template. I have done nothing else.
switching [[Ditto? &tpl=`DittoTemplate`]] for [!Ditto? &tpl=`DittoTemplate`!] makes no difference.
-
MODX Staff
- 95 Posts
It took me a while to get the hang of it, but it is really flexible. You need to make the Ditto call on the page that has documents underneath it (make sure they are published) or specify the ID the has the documents underneath.
For instance if this is your structure of pages in tree menu in your manager:
- News Page
| - News Item 1
| - News Item 2
| - News Item 3
Each page under News Page would be a news item; and if you call the Ditto Snippet on the News Page it will list the three news items (News Item 1, News Item 2 ...) on the News Page.
I believe the display default will display 3 or 5, but you can specify that with the &display...
Hope that helps, it was really confusing for me at first coming from other systems but once I understood how it worked it is really powerful and flexible and you can do so much more than just list news items.
Okay, so I need to make new documents and then set a Parent in order for this to work?
-
MODX Staff
- 95 Posts
Try creating some children documents of the page you are calling the snippet from.
Just make sure the created sub-page is published, and when you visit the page with the snippet it call it should list the newly created document formatted like your template chunk you made.
Oh my god, it works! Thank you! I presume this sort of hierarchy is necessary for NewsManger, too...
For the record, when certain instructions say to make a "folder" does that just mean "Parent" document? Notice under
Instructions here, it says to make folders:
http://modxcms.com/NewsManager-810.html
-
MODX Staff
- 95 Posts
Correct, NewsPublisher works using the same hierarchy.