We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46950
    • 86 Posts
    I guess, this question must be very easy for those who thinks a bit quicklier than me... So, let's imagine that a line in my chunk for getResources looks like this:

    <p><a href="[[~[[+id]]]]"><img class="alignleft" title="[[+tv.article_image_title]]" src="[[+tv.article_image]]" alt="" width="618" height="197" /></a>
    [[+content:ellipsis=`350`]]</p>
    


    I cannot understand where and how I must set initial values to [[*article_image_title]] and [[*article_image]]... Pls help!

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

    [ed. note: zwhzwh last edited this post 11 years, 11 months ago.]
    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Those would be TVs like any TV in each resource. The resource's TV values will get inserted into the placeholders of your tpl.

      How getResources works is that it gets a list of resources, according to what you tell it in its snippet properties.

      Then it goes through that list, and applies your tpl to each item in turn. That item's fields, including TVs if you tell it to include TVs, are put into placeholders, so that as the tpl is applied to the item the placeholders are filled with the value of the field for that item.

      Then it moves on to the next item in the list, and does the same thing. When it's all finished, the whole processed list gets returned.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org