We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8499
    • 19 Posts
    Hello there, I’m using getPage to add a listing of archived issues of a magazine website, and shows the issues resources ok, but not their content (which is a getResources call of each issue children).

    Basically, this is my archive folder structure:

    -Archive Res
    -Issue 45 Res
    - Name of article Res
    - Name of article Res
    - Name of article Res
    - Name of article Res
    -Issue 44 Res
    - Name of article Res
    - Name of article Res
    - Name of article Res
    - Name of article Res
    -Issue 43 Res
    - Name of article Res
    - Name of article Res
    - Name of article Res
    - Name of article Res

    So when the user is in the Archive page they should see 2 issues per page, and beneath each issue a list of their children (articles on each issue).

    This is the getPage call within the Archive Resource Content (You can see I added the includeContent call):
    http://www.barristermagazine.com/zstaging/archive.html
    [[!getPage? &element=`getResources` &parents=`41` &limit=`2` &depth=`0` &tpl=`archiveTpl` &includeContent=`1` &showHidden=`1` &sortby=`pagetitle` &sortdir=`DESC`]]  
    <hr />
    <div class="pageNav">[[!+page.nav]]</div> 


    This is the archiveTpl Chunk (you can see I have the content placeholder for the issue):
    <h3>[[+pagetitle]]</h3><br />
    <div>[[+content]]</div>


    And this is the getResources in each Issue resrouce content. It outputs an unordered list of its children resources, and when I preview the issue resource it works fine (http://www.barristermagazine.com/zstaging/archive-articles/issue-42/).
    <ul>
    [[!getResources? &parents=`[[*id]]` &tpl=`archiveRowTpl` &showHidden=`1` &limit=`20`]] 
    </ul>


    I am sure I may be missing something, but I’d very thankful for any light or help you experts can give me...
      • 8499
      • 19 Posts
      I’ve been trying to figure it out, but cannot see why is not picking up the content even though the includecontent is set to 1... Any help with this would be very much appreciated!
        • 22303 MODX Staff
        • 10,725 Posts
        You are trying to render a getPage call within a Chunk tpl for a Resource being summarized in another getPage call? That will not work.

        It is best to avoid trying to summarize content containing Snippets intended to execute on the originating Resource, as it will now run as if it is on the Resource being summarized in many cases. Presenting a dynamic view of another view with dynamic content is a slippery slope to start climbing down. It is much better if you summarize Resources without the burden of having to handle Snippets embedded in the summarized content.
          • 8499
          • 19 Posts
          alright, if this is not possible its ok, but would it be possible to use then Wayfinder with getPage? so it can return an unorganized list with different markup for parents and children? I’ll try that out.
            • 4172
            • 5,888 Posts
            if your content is
            <ul>
            [[!getResources? &parents=`[[*id]]` &tpl=`archiveRowTpl` &showHidden=`1` &limit=`20`]] 
            </ul>


            try:
            <h3>[[+pagetitle]]</h3><br />
            <div><ul>
            [[!getResources? &parents=`[[+id]]` &tpl=`archiveRowTpl` &showHidden=`1` &limit=`20`]] 
            </ul></div>

            for your tpl.

            documentField:[[*id]]
            getResourcesPlaceholder:[[+id]]

              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 8499
              • 19 Posts
              Bruno, you are an absolute star! that worked beautifully.

              Cool beans and thanks a lot, it seems I was trying to overcomplicate something that shouldn’t be in the first place.

              wink