We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36908
    • 2 Posts
    I'm setting up a modx site using 2.1.3-pl.

    I'm following the examples in the official documentation for setting up a blog. I've got most everything working.

    I have installed the getResources snippet.

    In the 'Adding a "Latest Posts" widget', there is an example getResources call. I modified it slightly to this:


    [[!getResources?
    &parents=`5`
    &hideContainers=`1`
    &tpl=`latestPostsTpl`
    &limit=`1`
    &sortby=`publishedon`
    ]]

    I've pasted this into a template for a page. In the resulting page, I see this:

    Array
    (
        [tpl] => latestPostsTpl
        [tplOdd] => 
        [tplFirst] => 
        [tplLast] => 
        [sortby] => publishedon
        [sortbyTV] => 
        [sortbyTVType] => string
        [sortbyAlias] => 
        [sortbyEscaped] => 0
        [sortdir] => DESC
        [sortdirTV] => DESC
        [limit] => 1
        [offset] => 0
        [tvFilters] => 
        [depth] => 10
        [parents] => 5
        [includeContent] => 
        [includeTVs] => 
        [showHidden] => 
        [showUnpublished] => 
        [showDeleted] => 
        [resources] => 
        [processTVs] => 
        [tvPrefix] => tv.
        [idx] => 1
        [first] => 1
        [last] => 1
        [toPlaceholder] => 
        [toSeparatePlaceholders] => 
        [debug] => 
        [where] => 
        [hideContainers] => 1
        [id] => 8
        [type] => document
        [contentType] => text/html
        [pagetitle] => First Post
        [longtitle] => First Post
        [description] => 
        [alias] => first-post
        [link_attributes] => 
        [published] => 1
        [pub_date] => 0
        [unpub_date] => 0
        [parent] => 5
        [isfolder] => 
        [introtext] => summary of first post
        [richtext] => 1
        [template] => 7
        [menuindex] => 0
        [searchable] => 1
        [cacheable] => 1
        [createdby] => 1
        [createdon] => 2011-09-12 21:02:05
        [editedby] => 1
        [editedon] => 2011-09-12 21:03:18
        [deleted] => 
        [deletedon] => 0
        [deletedby] => 0
        [publishedon] => 2011-09-12 21:02:00
        [publishedby] => 1
        [menutitle] => 
        [donthit] => 
        [privateweb] => 
        [privatemgr] => 
        [content_dispo] => 0
        [hidemenu] => 
        [class_key] => modDocument
        [context_key] => web
        [content_type] => 1
        [uri] => news/first-post.html
        [uri_override] => 0
    )
    


    What is happening here?
    Why is this call printing an array? How to I get it to just publish the target resource?

    Thanks.
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      It sounds like the template isn't defined properly or can't be found. Check that &tpl=`` exists and contains the correct chunk name.
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 22303 MODX Staff
        • 10,725 Posts
          • 36908
          • 2 Posts
          Got it!
          Thanks guys.

          I was following the revo docs for creating a blog with modx.
          I made a mistake on one of the details.

          "Adding a "Latest Posts" widget"

          I set up 'latestBlogPostsTpl' as a Template instead of a Chunk. Guess I was juggling too much terminology in my head.

          Thanks smiley