We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43122
    • 4 Posts
    Hello there!

    Ive wanted to use MODx for ages and have recently got around to creating a website within it, ive managed to create the header and navigation perfectly but now I am stuck as to how I would go about making my news area, I simply want to be able to add in content into the news module without needing to faf about in the code. Below is an image to my design that should hopefully shed a little more light on what im after! Also would I create these modules using Template Variables?



    Thank you in advance!
      • 3749
      • 24,544 Posts
      The most common method is to make each news story a Resource and use getResources to show the 5 or 10 mores recent ones.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 43122
        • 4 Posts
        Thanks for the reply,

        Ive been trying to do it all night and its just confusing the hell out of me, ive created two chunks one containing

        [[getResources? &tpl='news_style_tpl' &parents='7' &sortby='menuindex' &sortdir='ASC']]


        and the other

        <h1>[[*pagetitle]]</h1>
        
        <p>[[*content]]</p>


        I call the first chunk within the div that i want it displayed.

        and its just giving me this: http://www.imperioustest.tk/
          • 3749
          • 24,544 Posts
          That's getResources' way of telling you that it can't find a chunk called news_style_tpl. Chunk names are case-sensitive and the underscores in the name might be causing a problem.

          Also, you'll have to use &includeContent=`1` in the getResources tag if you want to show content, and if this is your Tpl chunk, it should be:

          <h1>[[+pagetitle]]</h1>
           
          <p>[[+content]]</p>
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 43122
            • 4 Posts
            Cheers for the reply,

            Ive taken the underscores out and made the changes you suggested, but adding the "&includeContent=`1`" to my getResources tag causes me to get a 404 error when trying to access my home page? If i take it out it then works again but continues to display all of that black code.

            Also do i need a template assigned to the resources that it is trying to fetch? As right now ive got the template set to "0"
              • 4172
              • 5,888 Posts
              use backtics!

              [[getResources? 
                  &tpl=`news_style_tpl` 
                  &parents=`7` 
                  &sortby=`menuindex` 
                  &sortdir=`ASC`
              ]]


              and is it possible you have something in one of your resource's content, which shouldn't be there?

              you don't need a template for a resource, but you should have one.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 43122
                • 4 Posts
                Lifesaver! Thanks thats done the trick smiley

                Now just to style the text accordingly to the rest of the website smiley


                Thank you again BobRay & Bruno17