We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20159
    • 26 Posts
    Hello

    I have been looking at Ditto most of this morning but cannot find a really REALLY basic guide to setting it up. I want to be able to post news items in a News section of the site, and have the headlines appear on the homepage of the site.

    I have been working with ModX for a few weeks now, on and off, and have successfully installed many snippets, but with Ditto I don’t know where to start.

    Can someone provide a really brief bullet points of how to set up? Or point me to a link if this already exists.

    Many thanks, I appreciate the help.
      • 7231
      • 4,205 Posts
      Ditto has some good but not simple documentation:
      http://ditto.modxcms.com/

      Check out the parameter section and you will see all that you can do.

      Here is a sample simple ditto call:
      [!Ditto? &parents=`12` &display=`all` &sortBy=`LastName` &sortDir=`ASC` &tpl=`dtTpl`!]


      In this call we are listing the documents within the parent 12, and we want to display all the documents, we are sorting by a TV called LastName ASCending and using the dtTpl chunk to display the results. In this chunk we have the display template using placeholders to add the data. Ditto will then loop through the docs and display the data according to the tpl.

      Here is a sample tpl from the MODx demo site:
      <div class="ditto_summaryPost">
        <h3><a href="[~[+id+]~]" title="[+title+]">[+title+]</a></h3>
        <div class="ditto_info" >By <strong>[+author+]</strong> on [+date+]. <a  href="[~[+id+]~]#commentsAnchor">Comments
        ([!Jot?&docid=`[+id+]`&action=`count-comments`!])</a></div><div class="ditto_tags">Tags: [+tagLinks+]</div>
        [+summary+]
        <p class="ditto_link">[+link+]</p>
      </div>
      Notice how the placeholders were used to add the data from the documents retrieved in Ditto.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 27708 MODX Staff
        • 2,502 Posts
        One of the best ways to breakdown how to use Ditto and many other snippets inlcuded with MODx is to do an install of MODx with the default Table Data so that you can see many of them in action.

        The ditto documentation is not difficult when you have had a chance to really get to understanding the way snippets work a little better (I am certainly no expert at the MODx parsing model) but I found the more I played the better I got--and get.

        Follow the Basic Blog Tutorial in the Wiki. You can omit the NewsPublisher section if you are going to be editing docs in the backend.

        All the best,

        Jay
          Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
          • 3749
          • 24,544 Posts
          I do something really simple with ditto and newspublisher that’s pretty close to what you want. I described it in the second half of this post:

          http://modxcms.com/forums/index.php/topic,18403.msg115330.html#msg115330

          Bob
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 20159
            • 26 Posts
            Thank you SO MUCH for your replies, it’s good to know the community is available.

            I have made some progress but will be sure to spend some time on your suggestions.

            I think I need to learn the ModX syntax in more detail.

            Thanks again.
              • 20159
              • 26 Posts
              Hello again,

              With your help, I have made progress. The only problem I now have is how to get "introtext" to display.

              I have set up a document group called "News" and when a new item is posted, Ditto successfully reads the title, date and author and uses the tpl chunk to format it. However it ignores introtext.

              I imagine I need to somehow tell the system what the "introtext" is - ie first paragraph of each article? This has really confused me.

              You can see the site here: http://www.judd-dev.co.uk/juddwebtoolbox/index.php?id=2

              Ditto is outputting the list of docs but introtext is ignored. How do I define it?
                • 7231
                • 4,205 Posts
                introtext is the text used in the introtext field. I think that you need to use the summarize extender in order to do this, in particular the truncAt parameter.

                http://ditto.modxcms.com/files/assets/snippets/ditto/extenders/summary-extender-inc-php.html
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don&#39;t know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 20159
                  • 26 Posts
                  Thank you. I successfully made the call using the summary extender. Great stuff.