We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18366
    • 14 Posts
    Hi, I’m from an assembler background and I hate web development and websites generally.

    Anyway, I like modx because it seems very flexible and fast, so I’ve adopted it in blind faith for several sites I have to do. I need these websites to avoid starvation, which is my main problem at the moment.

    I hope you like my biography above, so here’s my question:

    I have been looking for a modx tag that will get me the content for a given resource id. I don’t think such a tag exists. Using [*content*] is not what I want. Why isn’t there such a facility?

    Here are two examples of the problems this causes:

    I have a basic style blog display page, that pretty much uses the beginners example on how to create a blog. In the chunk that is used as the Ditto tpl parameter there are various placeholders to get all the parameters of an article, but how do I get the actualy article content itself? I want this as I want to create a blog style display page where the content of all the articles are displayed on one page, instead of having links to each article and the user have to go to an individual article page. If such a tag existed i could use it with [+id+] and insert article content instead of only being able to insert a link to it.

    Say I have a template with a few divs and each div has to display content of various resources on one page? How do I do that with just [*content*]?

    If anyone can help me, I’d be very happy.
      • 3749
      • 24,544 Posts
      In Ditto, you should be able to use [+content+].

      If you want to pull the content from a particular document without Ditto, you can use the getField snippet.
        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
        • 7231
        • 4,205 Posts
        MarkF - You might want to read the Nettuts MODx tutorial and scroll down to the Ditto: Repurposing Content section for an example on how to do this.

        Another good resource is the Using Ditto tutorial from Pogwatch.

        By adding the [+content+] tag into the Ditto tpl chunk it will return the entire content from the document that Ditto is instructed to retrieve the data from.

        For example the tpl might look like this:

        <div class="post">
          <h2>[+longtitle+]</h2>
          <p class="metadata">Published: [+date+] - Tags: [+tags+]</p>
          <div>
          [+content+]
          </div>
        </div>


        Also note that you can use PHx in Ditto tpls natively, no need to install PHx. THis can be handy for additional formatting or functionality.

        Hope this helps.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don&#39;t know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 18366
          • 14 Posts
          I can now pull out the content into my Ditto template and I’ve installed the GetField snippet and got everything working nicely.

          Many thanks to the BobRay and dev_cw for your technical support.
            • 3749
            • 24,544 Posts
            I’m glad you got it working. Thanks for reporting back.

            Welcome to MODx. smiley
              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