We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15745
    • 92 Posts
    I wasn’t sure where to post this - move it if necessary. I want to use ditto on my homepage as a blog that goes to two different articles pages - one for news and one for reports. The home page will have a brief intro of text for each article page with a link from the homepage to the whole article on the respective pages. I tried setting up a page to test this but it did not work (no documents found) I know I did something wrong (obviousley) but I don’t know what. How do you set up a new article so that it gets ’called’ by ditto? Greg (Pleth) gave me a good start but I’m missing something. Any ideas?
      Version: 0.9.6.3
      North Shore Web Design
      • 16278
      • 928 Posts
      It would help to see what have so far, by way of structure and any Ditto call you have tried. Your description can be read at least two ways, and the solution is simple in one case, not quite so simple in the other.

      The simple case: let’s say your structure is like this:
      1) Home page
      2) News page
      --News item 1
      --News item 2
      3) Reports page
      -- Report 1
      -- Report 2

      Your starting point here is a Ditto call on the Home page specifying the News and Reports pages as &parents
      [!Ditto? &parents=`2,3` &tpl=`home.tpl` ...other parameters...!]
      In the home.tpl chunk (which you will create), the placeholder [+url+] will generate a hyperlink to each of the listed items. (See http://www.pogwatch.com/ditto/ditto-parameters.html for a full list of parameters and placeholders).

      Or does "whole article on the respective pages" means you intend to have the sets of full articles running one after the other on the News or Reports pages? That’s possible with a further Ditto call on those pages using the [+content+] placeholder etc. I won’t go into detail as this seems less likely to be what you are after.
      smiley KP
      P.S. There is a specific Ditto forum at http://modxcms.com/forums/index.php/board,180.0.html
        • 15745
        • 92 Posts
        Thanks KP. Here’s what I’ve got so far. I created a ’blog’ parent page (once I figure this out the blog will be incorporated into the home page right column). I created 3 article pages following this tutorial http://wiki.modxcms.com/index.php/Ditto_-_2._How_to_Display_a_List_of_Articles. I get a message saying ’no documents found’. Here’s the link to the page http://www.massflyfishing.com/cms/index.php?id=60 Ignore the text on the left. I think I’m on the right track but I’m missing something. What I’m trying to achieve is to have the site’s homepage (right column) have two article summaries with links to full articles (and past articles) and different pages (news articles page and reports articles page) I’m not sure if I’m explaining myself clearly. Would I create 2 blogs: news blog & reports blog?
          Version: 0.9.6.3
          North Shore Web Design
          • 16278
          • 928 Posts
          For me, the text on the left says "Page does not exist (Page Not Found)"!

          Is the document published? (If not, you may be able to see it when you’re logged in, while others can’t). Have you made the articles Ditto is supposed to collect ’published’? Ditto defaults to showing published documents only (&showPublishedOnly=`1`).

          What does your actual Ditto call contain?
          wink KP
            • 15745
            • 92 Posts
            Sorry about that - it’s published now http://www.massflyfishing.com/cms/index.php?id=60. I created a chunk called tpl_Blog
            <h3><a href="[~[+id+]~]">[+date+] : [+title+] </a></h3>
              <p>[+content+]</p>

            which I put in the template
             
            <!-- start content area -->
                <div id="innerwrap">
                    <div id="content"><h2>Title here ... </h2> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed cursus imperdiet velit a lacinia. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin sollicitudin molestie diam et placerat. Vestibulum scelerisque, leo at sollicitudin tristique, leo massa tincidunt mi, in gravida risus diam eu nibh. Integer ligula urna, dignissim eu vestibulum eu, aliquam a dui. Nunc euismod, mauris id mattis viverra, lectus purus vulputate nibh, nec placerat nisl magna ac metus. Fusce purus lorem, porta eget pretium sit amet, porta a risus. Aliquam congue pretium ligula eu cursus. Donec eget viverra massa. Nulla in urna magna, sit amet tempor erat.  </div>
                    <div id="right"> [[Ditto? &parents=`60` &tpl=`tpl_Blog` ]]
             </div>
                </div>
               <!-- end content area --> 
            .... 
            

            Here’s the call itself <div id="right"> [[Ditto? &parents=`60` &tpl=`tpl_Blog` ]] </div>

            I’m sure something is wrong - I tried to follow the tutorial refernced earlier
            Basically, I am trying to do what you’ve done here http://www.pogwatch.com/blog.html with breif text and a link to each ’blog’ page(news/ reports)
              Version: 0.9.6.3
              North Shore Web Design
              • 4172
              • 5,888 Posts
              You are sure there are published documents under your folder with id=60?

              try to clear your modx-cache and call ditto uncached:

              [!Ditto? &parents=`60` &tpl=`tpl_Blog` !]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 15745
                • 92 Posts
                ok- it’s all published. I thought that if I published the blog pages all other pages would publish by default. Anyway, it’s working now. I guess what I din’t understand is how this works when I create new posts for the two blogs. How does Ditto put the most current or most 2 current entries on the page with some breif text and a link to the main article. What’s showing in the right column now is what would show on the page with all the articles. Do I create a new page (document) for each article? How do I create a page that displays the latest 10 entries for example.
                BTW - thanks for all your help on this
                  Version: 0.9.6.3
                  North Shore Web Design
                  • 16278
                  • 928 Posts
                  That’s looking a lot more promising! Keep going, and the penny will drop very soon now. rolleyes
                  Yes, each article is a document in its own right. Ditto generates a kind of index to sets of articles.

                  There are two fundamental kinds of Ditto parameters:
                  1) Parameters that select which documents are listed on the page containing the Ditto call, the order they are displayed in and how many are shown. Main parameters here are:

                  • &parents: source(s) of documents,

                  • &orderBy:sort field - defaults to "createdon", but any document field can be used,
                  • &display: how many to show in that order (e.g. &display=`10`)
                  2) Parameters that affect which parts of each selected document are displayed and how. These are the tpl template elements (not to be confused with document templates that provide frameworks for whole pages), mainly &tpl itself. The templates set the structure using HTML code, and include [+placeholders+] that will be filled in from components of the individual retrieved documents. These can be:

                  • built-in document fields, such as [+longtitle+] or [+introtext+]
                  • template variables, where you just put the name of the TV, [+myTvName+]
                  • Ditto-generated placeholders, such as [+author+] or [+summary+], where Ditto does some computing to select a relevant field or create the content.
                  In the Ditto template for your test page, you have used [+content+], and thus are showing the body of each document on page 60. If you used [+introtext+], you could create a concise trailer for each item, independent of the main content; or you could use [+summary+] and the summary extender to set up an automatically generated trailer.

                  Ditto generates a [+url+] placeholder which is equivalent to <a href="[~[+id+]~]">[+pagetitle+]</a> to create a link to each full item.

                  The Ditto [+date+] placeholder will default to showing the document’s createdon field, I don’t recall the standard format. You can choose which field to fill it with in your Ditto call: &dateSource=`pub_date` &dateFormat=`%d %B %Y`, for example.
                  wink KP
                    • 15745
                    • 92 Posts
                    I’ve spent two days trying to figure this out - I must be really stupid embarrassed
                    This test http://www.massflyfishing.com/cms/index.php?id=60 page is set up similar to my homepage. It uses this call in the template [[Ditto? &parents=`60` &tpl=`tpl_Blog` ]]. I created this chunk
                    <div style="padding: 5px;">
                    <div class="ditto_summaryPost">
                      <h4><a href="[~[+id+]~]" title="[+title+]">[+title+]</a></h4>
                      <div class="ditto_info" >By <strong>[+author+]</strong> on [+date+].</div>
                      [+introtext+]
                      <p class="ditto_link">[+link+]</p>
                    </div>
                    </div>
                    it is called ’tpl_Blog’ which gets called in the template page referenced above(id=60). I created some articles which show on the right column like I want. But, when you click the link it goes nowhere. All I want to do is have (on my homepage http://www.massflyfishing.com) the ability to have one blog entry from two different blogs I’ll create (one for ’news’ and one for ’reports’) show in the right column of the homepage. So all you’ll see in the right column is the current ’news’ blog entry (the entry will be brief - I tried [+introtext+] and [+summary+] but nothing showed) and the current ’reports’ blog entry. When the respective links are clicked, you will be directed to that blog where you’ll see the current entry and past entries.
                    I tried adding different parameters but nothing seemed to work. Can someone guide me in the right direction - I know I’m close. wink
                      Version: 0.9.6.3
                      North Shore Web Design
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      The links in the <h4> tags work fine. The [+introtext+] placeholders should work; are you sure you have content in the individual documents’ summary (introtext) fields? Or see this... http://www.pogwatch.com/ditto/ditto-extenders/ditto-summary.html

                      The text for the [+link+] placeholder is set by &truncText, default being `Read more...` (or equivalent in the relevant language file). You can set the code for the link using &tplTrunc to point to a chunk, file or code string of your own.
                        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