We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17097
    • 41 Posts
    Hi everybody,
    I am still learning how everything works in MODX.
    I installed a template with the possibility of adding news at the right side of the page.
    In the template I find this code:
    [[NewsListing?   &startID=`33` &truncText=`leggi tutto` &tpl=`rightnews`]]

    What do I do with this? I tried creating a chunk with the name :rightnews, but that doesnot work.
    What should I do?
      • 21191
      • 236 Posts
      First off I’d remove the & codes and replace with a & ... usually put snippet calls in chunks, so the TinyMCE editor doesn’t fudge with them.

      Second off I’d use Ditto.

      Here is a sample Ditto Call I use for listing blog posts (similar to news) in a compressed list.
      [[Ditto? &startID=`37`&dateFormat=`%b %d, %Y` &hideFolders=`0` &descendentDepth=`1` &tpl=`list_docs_blog_small_tpl`&displayArchive=`0` &total=`5` &summarize=`5` &sortBy=`pub_date` &sortDir=`DESC` &showInMenuOnly=`1`]] 


      I have a few more options set than you might need. but the important one is the startID .. that is the folder of all your news items. Learn to love Ditto smiley

      Then here is the template chunk I use.
      <li>
      <a  href="[~[+id+]~]">[+title+]</a>
      </li>


      The reason for no
      <ul>
      tags is I put those around the ditto call. Here is as it is in the template.
      <h3>Recent Blog Posts<br /></h3>
      <ul>
      [[Ditto? &startID=`37`&dateFormat=`%b %d, %Y` &hideFolders=`0` &descendentDepth=`1` &tpl=`list_docs_blog_small_tpl`&displayArchive=`0` &total=`5` &summarize=`5` &sortBy=`pub_date` &sortDir=`DESC` &showInMenuOnly=`1`]] 
      </ul>


      This is all live code here http://himmelbergerdesign.com in the footer.

      I have some tutorials out on how to use ditto to build other cool lsits, like podcasts and google sitemaps.
        ~Shawn Himmelberger
        Check out my MODx Development and MODx Design Company - Himmelberger Design
        • 17097
        • 41 Posts
        Hi Eddy,
        So if I understand you correct, I have to create a chunk with the code you suggested and place the ditto code in the template. But how do I name the chunk?
        And you speak of a folder in which the news is. But isn’t this just the id of a document in the menu?
        Here is my testsite. Then you see what I mean with where the news(nieuws) should be.
        http://www.jomedio.nl/modx/index.php
          • 21191
          • 236 Posts
          I attached a screenshot showing my blog folder.

          in MODx files with more files under it are called "folders" or "containers" or "parent" .

          so .. you should have a document called "News", then more documents under that document.

          Ditto will list those documents.

          Yes, ditto needs a template, if you supply no template it uses it’s own. I hope this helps.
            ~Shawn Himmelberger
            Check out my MODx Development and MODx Design Company - Himmelberger Design
            • 17097
            • 41 Posts
            Hi Eddy,
            Something is going wrong.
            This is what I did:
            -created a chunk with the name: Nieuws and with this code in it:
            li>
            <a  href="[~[+id+]~]">[+title+]</a>
            </li>

            -Then I have a folder called Nieuws and that has a bit of text in it.
            -In the template html I placed this code:
            [[Ditto?parents=`2`&depth=`0`&tpl=`nieuws`&display=`all`&filter=`hidemenu,0`]] 


            2 is the number of the Nieuws folder.
            But I get errors: http://www.jomedio.nl/modx/index.php
            What am I doing wrong?

              • 21191
              • 236 Posts
              2 things,
              1) I’m not sure if this was on accident but you’re missing part of the LI tag on the chunk
              2) look again at my snippet call, there is no parent parameter, it’s startID and so on.

              http://ditto.modxcms.com/files/snippet-ditto-php.html See full documentation on parameters for ditto here.

              I know it’s confusing, but stick with it!
                ~Shawn Himmelberger
                Check out my MODx Development and MODx Design Company - Himmelberger Design
                • 17097
                • 41 Posts
                Yes I saw it now, the missing <. Thanks for that. It works now. grin
                Is there also a way that an actual news message appears just under the Nieuws button? Say if I only have 1 news item of a few lines.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  @neon_eddy: startID is deprecated in the latest versions, the parameter is now "parents", and can be a comma-separated list of multiple document IDs to pull summaries from.
                    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
                    • 21191
                    • 236 Posts
                    I stand corrected, forgive me.
                      ~Shawn Himmelberger
                      Check out my MODx Development and MODx Design Company - Himmelberger Design
                      • 21191
                      • 236 Posts
                      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
                        ~Shawn Himmelberger
                        Check out my MODx Development and MODx Design Company - Himmelberger Design