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
    By "summary" I meant whatever you wanted to grab for your list. In your case, it’s just links. cool

    The document field named "Summary" is actually "introtext" in the database, a poor design decision when the document editing page was originally created. So if you want to use it, you have to use [*introtext*] or in Ditto [+introtext+]. That’s why I insisted they add (introtext) under the field’s name, since I could never remember what it was called, and kept having to go look in the site_content field in the database! Very annoying.
      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
      • 17097
      • 41 Posts
      Quote from: neon_eddy at Jul 01, 2008, 02:04 PM

      like intro text?

      yes .. use a template like this

      <div class="news-listing"><h2><a href="[~[+id+]~]">[+title+]</a></h2>
      <p>[+introtext+]</p>

      </div>

      Intro text is the summary, unless that’s changed now too smiley

      then of course remove the UL tags from the snippet code area

      What is introtext? And do I put the <div class="news-listing"><h2><a href="[~[+id+]~]">[+title+]</a></h2>
      <p>[+introtext+]</p>

      </div>
      in the template?
      And then change the id in this code?
        • 21191
        • 236 Posts
        <div class="news-listing"><h2><a  href="[~[+id+]~]">[+title+]</a></h2>
        <p>[+introtext+]</p>
        
        </div>


        the ID is a placeholder used by ditto.

        yes, create a template chunk and put this code in it, then tell ditto to use the newly created chunk.
          ~Shawn Himmelberger
          Check out my MODx Development and MODx Design Company - Himmelberger Design
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          introtext is the database field that holds what you put in the Summary field when editing a document. It is usually just a short bit of text (a summary, or introductory text) summarizing the document’s content. It is often used in Ditto along with the links.

          Make a chunk. Name it whatever you want; let’s say articleTpl. Put that template code in it.
          <div class="news-listing">
          <h2><a  href="[~[+id+]~]">[+title+]</a></h2>
          <p>[+introtext+]</p>
          </div>
          

          [~[+id+]~] may look a bit confusing; it’s two tags together. [~...~] makes a URL out of a document ID, and [+id+] is the placeholder Ditto will replace with the ID of the document it’s processing.

          Now on the page where you want the list to show up, make a Ditto call, with &parent=`id` where id is the document ID of the parent document whose children you want to list.

          Also put &tpl=`articleTpl`, or whatever you chose to name the chunk.

          [[Ditto? &parent=`id` &tpl=`articleTpl`]]
          


          If the individual article documents are children of the document that will be showing the list, you don’t even need to specify a parent ID; Ditto will use that document’s ID and make the list from its children by default.

          Ditto will loop through all of the children of the document whose ID you specified, and fill in the [+...+] placeholders with the information from each child document in turn, thus creating your list.
            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
            • 17097
            • 41 Posts
            @Sottwell; thanks for the explanation. It all is very difficult, but I am learning every day.

            Ok I created a new chunk, called Nieuws2 and put this code in it:
            <div class="Nieuws2"><h2><a  href="[~[+id+]~]">[+title+]</a></h2>
            <p>[+introtext+]</p>
            


            Then in the template I placed the Ditto code, but that isn’t right I think:
            <ul>
            [[Ditto? &tpl=`Nieuws2`]] 
            </ul></div>
            


            But then I get: no document found. Where am I going wrong?
              • 30030
              • 22 Posts
              Don’t forget to add the &startID param to the Ditto call to tell it which folder to look in for the documents.
              Also, for the divs, you want them being self contained in the chunks since the chunk given to &tpl is used for each document found.
              <div class="Nieuws2">
              <h2><a  href="[~[+id+]~]">[+title+]</a></h2>
              <p>[+introtext+]</p>
              </div>

              Then in the call:
              [[Ditto? &startID=`0` &tpl=`Nieuws2`]]
                • 21191
                • 236 Posts
                Yup, beat me to it. StartID or Parents needs to be the parent document of your items you want listed, no value defaults to the current ID
                  ~Shawn Himmelberger
                  Check out my MODx Development and MODx Design Company - Himmelberger Design
                  • 17097
                  • 41 Posts
                  Yes I got that to work. Thanks! grin
                  But my other question was; how do I get a few lines of text displayed under the Nieuws button?
                  Say if I only want to display a few lines of news there and further nothing.
                  I don’t understand how to get that to work.
                  http://www.jomedio.nl/modx/index.php
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    You mean for each line of news items, you want a few lines of text with its link? If that’s the case, that’s what the [+introtext+] placeholder will do. Put the few lines of text you want for that news item into the Summary field of the news item’s document. Ditto will display that text along with the news item’s link. Whatever placeholders you put in the chunk you use as a template, Ditto will display that field from the news item’s document.
                      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
                      • 17097
                      • 41 Posts
                      Quote from: sottwell at Jul 02, 2008, 01:01 AM

                      You mean for each line of news items, you want a few lines of text with its link? If that’s the case, that’s what the [+introtext+] placeholder will do. Put the few lines of text you want for that news item into the Summary field of the news item’s document. Ditto will display that text along with the news item’s link. Whatever placeholders you put in the chunk you use as a template, Ditto will display that field from the news item’s document.

                      Wel actually I mean, if I want to only place a few lines of News under the News button with no links, how do I do that?