On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hello,
    I have a website with photos. If I click one, you get to a subpage where you can see the photo in larger view with text and more information. Under the photo I would like to show all photos from the parents page. I tried the following call, which does not work.

    [[! GetResources?
    &parents `[[* id]]`
    & Tpl = `myfotosmini`
    & Show hidden = '1'
    & Include content = '1'
    & IncludeTVs = `1`
    & ProcessTVs = `1`
    & Sortby = `menuindex`
    & Sortby = `publishedon`
    & Sortdir = `ASC`]]

    If I enter the parent resource directly instead of [[* id]], the call works. I would like to automate it because I want to use the template for several different subpages of the same website.

    Can someone help me?

    Best regards,
    Michael

    This question has been answered by nuan88. See the first response.

    • discuss.answer
      Try `[[*parent]]` instead of `[[* id]]`
      • I assume you have installed getResource snippet.

        Typos are important especialy apostrophe which is the first key below ESC and before the [1/!] on your keyboard. Others are uppercase, spaces etc. Try this and take a look on differences:

        [[getResources? 
        &parents=`[[*id]]` 
        &tpl=`myfotosmini` 
        &showHidden=`1` 
        &includeContent=`1` 
        &includeTVs=`1` 
        &processTVs=`1` 
        &sortby=`{"menuindex":"ASC","publishedon":"ASC"}` 
        ]]
        


        BTW. Including content might be slow in big queries. Sometimes it's better to find other ways. And if you don't have to serve new content on each page refresh use cached snippets (without ! on front). [ed. note: godzio last edited this post 10 months, 1 week ago.]
        • As godzio says the properties between the back-ticks in the snippet tag have to be spelled exactly as they are in this section and the following sections: https://docs.modx.com/extras/revo/getresources#getResources-AvailableProperties
            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
          • Quote from: nuan88 at Jan 23, 2019, 03:58 PM
            Try `[[*parent]]` instead of `[[* id]]`

            Good Morning all,

            thank you for your help.

            This proposal works for me. I am a beginner with getresource.

            Best regards,
            Michael