We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9436
    • 26 Posts
    Hi, Ive got problem with latest news with Ditto. I’ve found some posts about it, but no one answer my issue (which regards basics...): what code should I put on home page to have listing of latest five blog entries , just titles, without summary? I use code like this:

    [!Ditto? &startID=`2` &summarize=`1` &total=`2` &trunc=`false` &paginate=`false` &dateFormat=`%d. %B %Y` &placeholder=`ditto_object` !]

    Also is it possible to show items horizontaly, not one below the other like its doing now?

    Thanks in advance.
      • 33982 ☆ A M B ☆
      • 476 Posts
      Hi, Ive got problem with latest news with Ditto. I’ve found some posts about it, but no one answer my issue (which regards basics...): what code should I put on home page to have listing of latest five blog entries , just titles, without summary?
      Well, you’re going to need to set up a few things to just get a title in your Ditto output and have the parameters you are requesting. Let’s take your example from the top down. Here’s an example Ditto call for what you’re requesting:

      [!Ditto? &startID=`2` &tpl=`newsTPL` &summarize=`5` &sortDir=`ASC` &sortBy=`pub_date` !]
      To begin, the "&startID" needs to be the ID of the parent which is the container for the blog postings. So if the unique ID of the parent is "2", put &startID=`2` ...

      Next, have "&summarize" equal to 5 since you want the last 5 postings. The "&sortDir" will control whether the postings are ascending (ASC) or descending (DESC). You need to define how they’re sorted (by publication date or menuindex, etc.). In my example above I chose to sort by publication date (pub_date).

      Next you need to define your tpl value which tells ditto what information to show. You just wanted titles, so create a chunk named whatever you want (in my example I made it to be "newsTPL") ... in that chunk, if you just wanted the pagetitle to appear, you would just put the following into your chunk:
      [+pagetitle+]

      or you could put:
      [+longtitle+]

      Hopefully that makes sense.
        Precision Web Development ... SmashStack.com
        • 33982 ☆ A M B ☆
        • 476 Posts
        Also is it possible to show items horizontaly, not one below the other like its doing now?
        The layout of the output has nothing really to do with Ditto’s ability, but it has to do with the way you set up the coding for your "tpl" value. Just think in terms of HTML when constructing your "tpl" value. If want to show items horizontally, code the "tpl" values to output horizontally.
          Precision Web Development ... SmashStack.com
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Usually it’s done with CSS, just as you would style static blocks of HTML. Ditto will generate the blocks, it’s up to you to style them and position them in your .css file.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 9436
            • 26 Posts
            thanks to you all for ideas, I’m going to try them now smiley