We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I thought I saw a post about using Ditto to display the summary for a given document (such as a "Special" news item on the front page), but now I can’t seem to find it. Is there way to do that?
      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
      • 33673
      • 14 Posts
      I applied the fix from the other post to make multiple ditto calls on one page. However, I got 3 but only the first is still showing. The rest shows the code.

      I’m using: [!Ditto? &startID=`31` &summarize=`2` &sortDir=`ASC` &trunc=`0` &language=`swedish` &mode=`production` &tpl=`ExhibitionNews`!]

      And just change the startID.

      Also when listing the archives if the date is set to show full weekday. When a day with foreign characters such as åäö is displayed it shows as: "söndag" instead of "söndag".
        • 30948
        • 3 Posts
        I noticed that $dateFormatType always ended up with createdon, even if $sortBy was set to another document field. As it turns out, the first ’if’ in checkDateFormat always fails:

        			if ($sortBy != 0  && ($sortBy == "createdon" || $sortBy == "editedon" || $sortBy == "pub_date" || $sortBy == "unpub_date" || $sortBy =="deletedon")) {


        changing this line to:

        		if ((!empty($sortBy)) && ($sortBy == "createdon" || $sortBy == "editedon" || $sortBy == "pub_date" || $sortBy == "unpub_date" || $sortBy =="deletedon")) {


        seems to fix the problem.

        Cheers,
        Ulrich
          • 33453
          • 141 Posts
          Quote from: Mark at May 28, 2006, 03:54 PM

          As I said earlier, MODx does not set publishedon when saving a document unless the user expressly sets it. Therefore a complex inline SQL query swaps between publishedon and other fields like it with createdon if the value of the field is 0.

          Oh yes it does grin - in "save_content_processor.php" (though it doesn’t do it very well at the moment - see here)!!

          There are 2 sets of fields - "publishedon"/"publishedby" which are set automatically, and "pub_date"/"unpub_date" which are the user selectable ones. I think you are confusing the two.
            • 29635
            • 361 Posts
            Quote from: udoewich at Jun 01, 2006, 11:06 AM

            seems to fix the problem.
            @Ulrich: THANK YOU THANK YOU THANK YOU.

            I knew I wasn’t crazy.
              Need MODx Ecommerce? Try FoxyCart!
              • 1549
              • 20 Posts
              I have a problem with ditto. The full news won’t open when clicked on "Read only" or the linked title.

              I use
              [[Ditto? &tpl=`DittoTemplate` &startID=`12,13,14` &summarize=`3` &multiLevel=`1` &truncLen=`200` &hideFolders=`1` ]]


              Ditto is a fine piece of a script. Good work.
                • 18397
                • 3,250 Posts
                Thanks. Could you copy and paste your Ditto template so I can examine it? Thanks.
                  • 1549
                  • 20 Posts
                  <div class="clanak">
                  	<h2><a href="[~[+id+]~]">[+title+]</a></h2>
                  	<div>[+summary+]</div>
                  	<p>[+link+]</p>
                  	<br />
                  	<small><p><strong>[+author+]</strong> | datum: [+date+]</p></small>
                  </div>
                  



                  here it is.

                  EDIT: Please use code tags
                    • 18397
                    • 3,250 Posts
                    There doesn’t seem to be anything wrong with your chunk. Can you run the snippet with &debug=`1` and copy and paste the output here. Thanks.
                      • 1549
                      • 20 Posts
                      Number supposed to be summarized (summarize): 3

                      Total supposed to be returned: 1
                      Count of total in db: 1
                      Sort by (sortBy): createdon
                      Sort direction (sortDir): DESC
                      Using the GetAllSubDocs Method (allows for all possibilites but is a little slower)
                      Start at 0 and stop at 1 out of 1

                      Document Data for "Članak jedan"
                      id = 18
                      type = document
                      contentType = text/html
                      pagetitle = Članak jedan
                      longtitle = Long title članka1
                      description = Description članka1
                      alias =
                      published = 1
                      pub_date = 1149264731
                      unpub_date = 1149264731
                      parent = 12
                      isfolder = 0
                      introtext =
                      richtext = 1
                      template = 4
                      menuindex = 0
                      searchable = 1
                      cacheable = 1
                      createdby = 1
                      createdon = 1149264731
                      editedby = 1
                      editedon = 1149266552
                      deleted = 0
                      deletedon = 1149264731
                      deletedby = 0
                      menutitle =
                      donthit = 0
                      haskeywords = 0
                      hasmetatags = 0
                      privateweb = 0
                      privatemgr = 0
                      content_dispo = 0
                      hidemenu = 0
                      currentTPL = firstRow

                      This discussion is closed to further replies. Keep calm and carry on.