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

    I’m trying to get a list of child resources but all I get is their properties on arrays, it seems that the snippet can’t see the template.

    I’ve got this content on resource ID 4:

    [[!getResources? &parents=`4` &limit=`5` &tpl=`randomTpl` &includeContent=`1`]]


    and the code on randomTpl is:

    <div class="resource_id">
      resource id: [[*id]]
    </div>
    <hr/>


    I have three childs assigned to resource ID 4, but all I get back when I access the resource are three arrays like this:

    Array
    (
        [tpl] => randomTpl
        [tplOdd] => 
        [tplFirst] => 
        [tplLast] => 
        [sortby] => publishedon
        [sortbyAlias] => 
        [sortbyEscaped] => 0
        [sortdir] => DESC
        [limit] => 5
        [offset] => 0
        [tvFilters] => 
        [depth] => 10
        [parents] => 4
        [includeContent] => 1
        [includeTVs] => 
        [showHidden] => 
        [showUnpublished] => 
        [showDeleted] => 
        [resources] => 
        [processTVs] => 
        [tvPrefix] => tv.
        [idx] => 1
        [first] => 1
        [last] => 3
        [toPlaceholder] => 
        [debug] => 
        [id] => 6
        [type] => document
        [contentType] => text/html
        [pagetitle] => Fill 2
        [longtitle] => 
        [description] => 
        [alias] => 
        [link_attributes] => 
        [published] => 1
        [pub_date] => 0
        [unpub_date] => 0
        [parent] => 4
        [isfolder] => 
        [introtext] => 
        [content] => Contingut del fill 2.
        [richtext] => 1
        [template] => 1
        [menuindex] => 1
        [searchable] => 1
        [cacheable] => 1
        [createdby] => 1
        [createdon] => 2010-09-03 11:57:44
        [editedby] => 1
        [editedon] => 2010-09-03 14:42:44
        [deleted] => 
        [deletedon] => 0
        [deletedby] => 0
        [publishedon] => 2010-09-03 14:42:44
        [publishedby] => 1
        [menutitle] => 
        [donthit] => 
        [haskeywords] => 
        [hasmetatags] => 
        [privateweb] => 
        [privatemgr] => 
        [content_dispo] => 0
        [hidemenu] => 0
        [class_key] => modDocument
        [context_key] => web
        [content_type] => 1
    )
    


    I just started using MODx and am still having trouble understanding how it works, so forgive me if the question is very stupid tongue

    Thanks for your help!
      • 31519
      • 2 Posts
      Mmm, ok, I just found the answer on this post:

      http://modxcms.com/forums/index.php/topic,52575.0.html

      The thing is that I was expecting the snippet results to be rendered on a template but it has to be done on a chunk, I don’t get why the notation is &tpl, then tongue
        • 1778
        • 659 Posts
        Hello



        The thing is that I was expecting the snippet results to be rendered on a template but it has to be done on a chunk, I don’t get why the notation is &tpl, then

        It’s because chunks used as templates for snippets are called "myChunkTpl" to indicate they are used as a template for the output, so the param in the call is too &tpl...
          • 20407
          • 82 Posts
          Quote from: anso at Sep 03, 2010, 04:19 PM

          It’s because chunks used as templates for snippets are called "myChunkTpl" to indicate they are used as a template for the output, so the param in the call is too &tpl...

          I also find this confusing and your explanation inadequate. As a noob myself, it’s hard enough to understand the difference between a template and a chunk in the first place (since chunks seem to work basically the same as templates), but to then refer to a chunk with &tpl= just makes it worse. If it’s referring to a chunk, the syntax should be &chunk=.