We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14834
    • 3 Posts
    Getting incredibly frustrated trying to get getPage or getResources working, everything I do results in an array being dumped.

    This is an example of one of the many code snippets I have tried:

    [[!getPage?
       &elementClass=`modSnippet`
       &element=`getResources`
     
       &parents=`26`
       &depth=`2`
       &limit=`10`
       &pageVarKey=`page`
     
       &includeTVs=`1`
       &includeContent=`1`
     
       &tpl=`newsListItem`
                            
       &debug=`1`
    ]]
    <div class="paging">
    <ul class="pageList">
      [[!+page.nav]]
    </ul>
    


    and the very simple contents of newsListItem:

    <h2>[[+pagetitle]]</h2>
    



    • Yes, I’m using backticks, not quotes.
    • Yes, the template exists and is spelt correctly with the correct case.
    • I’ve tried creating new templates and I’ve tried re-writing the snippet.
    • The parent resource exists and there are child resources underneath. The child resources are included in the array output.

    The error log contains the following unhelpful error message:
     [2011-04-17 12:46:43] (ERROR @ /index.php) SELECT `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`content`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`haskeywords`, `modResource`.`hasmetatags`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type` FROM `modx_site_content` AS `modResource` WHERE  (  ( modResource.parent IN (26,29,30) AND (modResource.context_key IN ('web') OR EXISTS(SELECT 1 FROM `modx_context_resource` ctx WHERE ctx.resource = modResource.id AND ctx.context_key IN ('web'))) )  AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 AND `modResource`.`hidemenu` = 0 )  ORDER BY publishedon DESC LIMIT 10 


    I’m using MODx Revolution 2.0.8-pl (traditional) with getPage 1.0.0 pl and getResources 1.3.0 pl.

    I’m running off my local machine on OSX, using MAMP PRO. PHP version 5.2.11, MySQL version 5.1.37.

    Am I doing something stupid or have I run into a bug here?
      • 3749
      • 24,544 Posts
      Have you tried it with &debug=`0` ?
        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
        • 14834
        • 3 Posts
        I haven’t tried &debug=`0` but have tried it with the debug parameter removed completely, which I would immagine achieves the same?

        I will try &debug=`0` later today anyway and report back.
          • 22303 MODX Staff
          • 10,725 Posts
          And by "template", I hope you meant Chunk, since getResources tpl’s are Chunks, not actual MODX Templates.
            • 14834
            • 3 Posts
            Doh! Full points go to OpenGeek for spotting my stupid mistake.

            I was in fact trying to use a template as opposed to a chunk with the &tpl=`` parameter.

            This was the first time I’ve used getResources/getPage, in fact it’s the first time I’ve used MODx so I completely forgot about chunks in this scenario and literally took the ’tpl’ parameter as meaning ’template’.

            Having created a chunk, it is now working as intended, thank you.
              • 3749
              • 24,544 Posts
              I’m glad you got it sorted.

              That’s exactly why it’s important to refer to them as Tpl chunks. wink

              They are template-like and they’re used for templating, but they’re not templates.
                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