Hi, I’m new to Modx, working on a site for work, off-line so can’t show the Link right now. Ditto is confusing for us newbies. I’ve been laboring over various ways to use Ditto to produce lists of news updates for this site. One of the purposes is a page frequently updated with pdf news releases. There are not actual web pages of the releases, just the pdf forms of the releases. Eventually, I want the page listing them to have an RSS feed for the journalists who will visit the site.
Here is what I did, sharing in case it might help someone else figure out the mysteries of Ditto. Experienced modx-ers please comment if I could have done this in a better/more efficient way.
1) I made a template for Ditto to use to produce the information I want to appear on the page that will list the pdf releases; here is the code for the template:
<div class="ditto_itemNC" id="ditto_item_[+id+]">
<ul>
<li class="ditto_pageTitle">[+date+] <img src="images/icon-pdf.gif" alt="pdf file" width="15" height="15" /> <a href="[~[+id+]~]">[+pagetitle+]</a></li>
</ul>
</div><!-- close DittoTemplateNC -->
2) I made a new document to serve solely as the container for the pdf files. It is set as
* published
* a container
* not searchable (doesn’t need to be)
* minimal template (I guess it could be a blank template also)
3) With File Manager, I made a new folder, "news-updates" and using File Manager again, uploaded the pdfs into this folder. The pdfs have file names relevant to their content.
4) In the admin panel, Site tab, using "new Weblink" function, I made a "document" for each pdf files (actually a web link but modx calls the webinks documents because that’s just how modx works) :
On Page Settings tab, I filled in:
* published
* published date as per the news release date
* not a container
and on General Tab:
* title
* weblink url (this is to each pdf file in the news-updates folder of step 3))
The urls are relative and working fine that way. I’ll have to change this when we go online though because my modx install for development is in a sub-folder but won’t be when it’s live. So be careful with this url path.
Finally, at the Document Parent line on the WebLink display, click the little folder icon (it opens, showing it’s available to be connected to a parent document), and then on the left, I associated each weblink with the container document made above in step 2).
The template above, in step 1, is going to arrange all these weblinks to the actual pdfs in an unordered list, with the date preceding the link and a small pdf icon following each link, to warn the visitor it’s not a page but will open their pdf reader program.
5) in my stylesheet, I added these styles (which are the classes applied in the template above in step 1):
.ditto_itemNC ul {
list-style-type:none;
margin:15px 0;
}
li.ditto_pageTitle {
padding-left:20px;
margin:8px 0;
}
I already had classes set for link styles.
Finally, step 6), I put a call to Ditto on the page where I want the list of the pdf updates to appear:
[[Ditto? &parents=`22`&depth=`1`&tpl=`DittoTemplateNC` &dateSource=`pub_date` &dateFormat=`%b. %d, %Y - ` &display=`all` &sortBy=`pub_date`]]
The Ditto call is referencing my container folder (id 22), using my template (DittoTemplateNC), ordering the items by their publishing date, using the format of an abbreviated month, 2-digit day, 4 digit year.
Okay, that’s all. I haven’t figured out the RSS feed yet... I made the feed but don’t get yet how to make it available to site visitors?
but now I have the automatically updating page that the feed will read. I hope this helps some other person newer to Modx than I am.