We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13137
    • 204 Posts
    I would like to have displayed on the front page, the latest post to be displayed in full, followed by the summaries of 5 older posts.

    Any recommended setups for this.
    How would I pull just the most recent post in full?
    Would I have to have it followed by the same post in summery form as well as the others?

    Any help is much appreciated. huh
      • 7231
      • 4,205 Posts
      Use ditto and have a custom tpl for the first (or latest) news using the firstTpl and the rest usng the normal tpl/ Then in the firstTpl use the [+content+] placeholder and in the others use the [+summary+] placeholder (make sure to include the summary extender n your Ditto call).

      You could also use PHX to truncate the text. But I think that the summary extender is easier t work with.
        [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't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 13137
        • 204 Posts
        How would I set this up, seeing how every week the first one would change?
        Is there a way that I can just pull the latest/newest?
        Thanks.
          • 3749
          • 24,544 Posts
          Ditto will automatically put the most recent one first and format it as you’ve described if you set it up as dev_cw suggests.

          http://wiki.modxcms.com/index.php/Ditto
          http://ditto.modxcms.com/
          http://modxcms.com/forums/index.php/board,180.0.html

          Put all the news stories under a container document and note its document id (let’s say it’s 75). Then you’ll want a Ditto call something like this:

          [!Ditto? &parents=`75`&sortBy=`createdon`&summarize=`5`  &total=`5` $tplFirst=`first` &tpl=`others` &extenders=`summary` !]

          Then, you’ll need two chunks, one called "first" and one called "others."

          "first" will look something like this:

              <h3>[+title+]</h3>
                [+content+]
                <a href="[+id+]" title="[+title+]">See more about this story . . .</a> 
               Posted by [+author+] on [+date+]

          "others" will look something like this:

             <h3>[+title+]</h3>
                [+summary+]
                <a href="[+id+]" title="[+title+]">See more about this story . . .</a> 
               Posted by [+author+] on [+date+]


          You can add some divs for styling.

          This is off the top of my head, but it should get you started. smiley
            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
            • 13137
            • 204 Posts
            Thank you for the help.
            I hadn’t seen anything about "$firstTpl" before.

            I will try this out today and report back in a while.
            Thanks again.
              • 33337
              • 3,975 Posts
              Quote from: islander at Jan 26, 2009, 02:41 AM

              ...
              I hadn’t seen anything about "$firstTpl" before.
              ...
              I suppose, it was a typo, and its "&" instead of "$". Actual available parameters are:

              tpl
              tplAlt
              tplFirst
              tplLast
              tplCurrentDocument

              More here: http://ditto.modxcms.com/files/snippet-ditto-php.html
                Zaigham R - MODX Professional | Skype | Email | Twitter

                Digging the interwebs for #MODX gems and bringing it to you. modx.link
                • 13137
                • 204 Posts
                Does not seem to be working for me huh
                I am using a default install of 9.6.3

                with the chunks above and

                [!Ditto? &parents=`2`&sortBy=`createdon`&summarize=`5`  &total=`5` &tplFirst=`first` &lastTpl=`last` &tpl=`others` &extenders=`summary` !]


                Nither "&firstTpl" or "&lastTpl" seem to work, only "&tpl"

                Sorry if I am being a bit dense, but am I missing something here?
                  • 13137
                  • 204 Posts
                  OK, I think I got it. At least for First.

                  The call had another typo. It was listed as firstTpl but should have been tplFirst  wink

                  &tplLast doesnt want to work, but not needed at the moment.

                  Thank you for your help.  grin