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

    I’m running 2.1.1, installed getPage and getResource, and I’m new to MODX, and have to say it is a bit hard. But I guess many of you experienced the same when started.

    I found the docs at http://rtfm.modx.com/display/ADDON/getResources

    First question that arises when reading this is: what does [[!page.nav]] do? I cannot find any docs on this.

    Second, I cannot get this work, and had hoped to find some hints to better understand how MODX does the thing

    My template section
    ...
    [[!getResources? &parents=`3` &tpl=`myRowTpl` &tvPrefix=`` &includeTVs=1]]
    <div class="pageNav">[[!+page.nav]]</div>
    ...

    My chunk
    <div>[[*page_title]]</div>


    The output I get is 3 rows (which is correct, the resource 3 is a folder and has 3 sub resources), but the output displays the details of the current resource displayed, and not of the resources returned in getResources.

    I have to say that modx looks promising, but for now this is one of the hardest open source applications to understand.
      • 14668
      • 11 Posts
      Hi pdaalder,

      Your calls are wrong in a couple places. &includeTVs=1 should be &includeTVs=`1` (forgot the hashmarks)

      And [[*page_title]] in your chunk should be [[+pagetitle]]

      Best practice I find to look for solutions (or documentation) is to use Google to search the modx forums, not the SMF forum search tool. I would’ve referred you to the rtfm site you linked to...

      Hang in there, Modx can seem intimidating at the beginning but once you get the hang of it, it’s really versatile.
        • 35701
        • 3 Posts
        Cheers, the title part definetely was wrong,but still my chunk is displaying the info from the main page, and not from the getResource pages
        current page: 6 . Jul 12, 2011 . test file 2
        getResource - start
        6 . Jul 12, 2011 . test file 2
        6 . Jul 12, 2011 . test file 2
        6 . Jul 12, 2011 . test file 2
        getResource - end 


        My chunk is now
        <div>[[*id]] . [[*START_DT?]] . [[*pagetitle]]</div>


        If I remove the &tpl, I do get the array dump, and the array is displaying the 3 pages as expected, but some how the tpl isn’t using that information, but the information of the current page.

        Also, what does this part do: "<div class="pageNav">[[!+page.nav]]</div>". Is there some docs on the page.nav tag?

        Cheers for your help. Also is there away to ’debug’ your templates/chunks, or to validate them?
          • 3749
          • 24,544 Posts
          You need this to get the values from the pages getResources is retrieving:

          <div>[[+id]] . [[+START_DT?]] . [[+pagetitle]]</div>


          If START_DT (which shouldn’t have a question mark unless you’re going to add properties to the tag) is a TV, you’ll also need &tvPrefix=``.
            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
            • 35701
            • 3 Posts
            sweet thnk this fixed it. many many thnx for pointing out the syntax error

            Is the ’+’ specific to getResource? Do you know where i can find info on +page.nav?
              • 3749
              • 24,544 Posts
              Quote from: pdaalder at Jul 15, 2011, 12:31 PM

              sweet thnk this fixed it. many many thnx for pointing out the syntax error

              Is the ’+’ specific to getResource? Do you know where i can find info on +page.nav?

              Good question. No, it’s common to any snippet that uses Tpl chunks. [[+placeholderName]] is a placeholder tag, which is what Tpl chunks always contain. The snippet replaces the placeholder tags in the Tpl chunk for each resource it retrieves.

              [[*fieldName]] is a resource field/TV tag, and always gets the value from the current resource, no matter where it’s placed.
                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