We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10405
    • 288 Posts
    We’re trying to set up a system using Ditto where various article resources are pulled onto the front page by a Ditto call, currently as follows (for example):

    [!Ditto? &documents=`182` &tpl=`ditto.editorspick` &extenders=`summary` &truncLen=`390` &truncText=`Read More`!]

    What we need is for content managers to be able to change the backend resource for another one, without changing the &documents ID (apparently this simple task is beyond them), so in other words the call always points to the same document. However they need to be able to easily (i.e single button click) archive off the article content so it disappears, goes into a new resource, then 2 things happen- they can start typing their new artidcle in the blank space that’s left, and also a link appears to the old article at the bottom of the page. This should then happen again every time they want to archive off the old content and start again with the next new article.

    How can this be achieved?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      In my opinion, you are going about this in the wrong way. You should have your articles in a given container document, and use &parents to tell Ditto to get its documents from that container, then specify one document for display. By default it will get the newest document first. Then the older documents can easily be archived using other Ditto calls or the Reflect archiving snippet. Then your editors just need to create a new document, and automatically it will be the one to be displayed.
        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
        • 10405
        • 288 Posts
        Hi, the problem is that the front page needs to display not just one article but the "teasers" i.e first x characters for six different articles which all have different content...

        So we need to have these mutliple calls that each pull in a different article resource.

        Any way that this can be accommodated?
          • 4172
          • 5,888 Posts
          If you are really sure there is no way to call your articles at once, because every ditto-instance has its own chunk and own position on your page (btw. this could also be done with one call), you have to get your needed document-ids dynamically and store them into placeholders. So you can use them like that:

          [!Ditto? &documents=`[+id_1+]` &tpl=`ditto.editorspick` &extenders=`summary` &truncLen=`390` &truncText=`Read More`!]
          [!Ditto? &documents=`[+id_2+]` &tpl=`ditto.editorspick` &extenders=`summary` &truncLen=`390` &truncText=`Read More`!]

          But I don’t think it is necessary.
          You could also save the ditto-results in placeholders and put them in your template where needed and there are a lot of more ways, todo what you want without changing the documentIDs manually.

          I think nobody would move the content from one resource to another to achieve what you want.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 10405
            • 288 Posts
            Thanks, how and where would I set up these placeholder IDs?

            And there needs to be a way to auto-archive a resource with a single click of a button in the backend, so the editor can then start creating a brand new article.

            I don’t think one Ditto call could be used for all six articles, because the "intro" content that appears on the front page needs to appear in separate distinctive areas (different positional divs).

            I just need to know how I can proceed with this in such a way that the users can do their work without needing to edit &documents ID. If it was just a single article I guess as Susan said it could go into a container and then the most recent gets picked regardless of ID. The problem is with these six distinct articles that need to be shown on the front page in different areas...
              • 4172
              • 5,888 Posts
              Ok,
              1. you have 6 different areas, right.
              2. you want the user can add new articles to each of these areas, right?
              3. you want to see only the newest articles in these areas right?

              why not using 6 folders in your site-tree and call each area with:
              -folder area1
              --news for area1
              --news for area1
              --news for area1
              -folder area2
              --news for area2
              --news for area2
              --news for area2
              -folder area3
              --news for area3
              --news for area3
              --news for area3
              -folder area4
              --news for area4
              --news for area4
              --news for area4
              -folder area5
              -folder area6

              [!Ditto? &parents=`id_of_folder area1` &display=`1` &tpl=`ditto.editorspick` &extenders=`summary` &truncLen=`390` &truncText=`Read More`!]
              [!Ditto? &parents=`id_of_folder area2` &display=`1` &tpl=`ditto.editorspick` &extenders=`summary` &truncLen=`390` &truncText=`Read More`!]


              or use a TV ’areatv’ where you can choose the area where the news should go and use &filter

              [!Ditto? &parents=`folderid` &display=`1` &filter=`areatv,1,1` &tpl=`ditto.editorspick` &extenders=`summary` &truncLen=`390` &truncText=`Read More`!]
              [!Ditto? &parents=`folderid` &display=`1` &filter=`areatv,2,1` &tpl=`ditto.editorspick` &extenders=`summary` &truncLen=`390` &truncText=`Read More`!]


                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 10405
                • 288 Posts
                That sounds like it could work- I’ll give it a go. Thanks for the pointers.