We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27629
    • 17 Posts
    Sorry to open an old thread, but im jumping in at the deep end (always the best way to learn i reckon) and this is a subject that im currently wokring on.

    Thanks to this thread i’ve succesfully got a working news section, not quite perfect yet, but im sure we’ll get there.

    My question for the moment is how to present the short list of 3 news articles on all pages and not just the parent news page?

    At the moment the short articles list is only displayed when i click on the primary news parent page, but what im trying to do is control what pages display this shortlist (i.e.homepage, newspage). I might be right in thinking that i need to use a chunk (which i beleive works much like an php include)? But that means that i need seperate templates for each page in order include/exclude the chunk, but im trying to use just one site wide template.

    Any help on this would be very much appreciated.

    p.s. You know when you are trying out different software or appications either for a client, trying to research the best software for the clients needs, or just playing as you do, It’s so rare that you get that big grin across your face and that feeling of excitment when you know that you’ve stumbled upon such a great piece of software. I got that when i installed and started playing with Modx, i should really be doing some work, but i can’t stop playing with this software.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You need to have the Ditto snippet call on all of the documents where you want the list of news items. By default it will use the page it’s on as the parent, but you can change that with the &parents paremeter.

      Snippets are the PHP code containers for MODx, chunks are purely HTML (and MODx tags), just like miniature templates.

      This may be of use to you http://www.sottwell.com/modx-from-the-inside.html
        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
        • 27629
        • 17 Posts
        Hmm...im not sure i get you...

        Here’s a quick explanation of what im doing...

        In the right column of minimal tmeplate i have this code:

        [[Ditto?&depth=`1` &display=`3` &orderBy=`id DESC`]]


        Now when im on the Parent News page is displays the 3 articles as described in this thread - great!

        It displays a brief summary text, title and link to the main article, just what i want.

        However when i then navigate to the homepage the three news articles are replaced with a link to the Child Doc of the main page.

        What i want is for the news articles to always be displayed in the right column unless i specify otherwise.

        I hope that makes sense and thanks for your input on this.
          • 27629
          • 17 Posts
          Ah...i did as you suggested and added the &parents=’4’ (4 representing the menu index?) and it now displays child documents of news page, is that the correct way of specifying the &parents paremeter?
            • 27629
            • 17 Posts
            I’ve come across a problem with this...

            The author name defaults to ’default admin account’ when you are viewing some pages and to ’*specified account name*’ when on other pages, why is this and how can i get it to dislay ’*specified account name*’ at all times?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              It all depends on what user created those documents. If you need to change the creator, you’ll need to first get the ID of the user you want to have be the creator, then go into the database in the site_content field change the createdby field to the ID of the user you want.

              You should probably also go edit your default admin user’s account to give him a real full name, instead of the default installation full name.
                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