We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39678
    • 68 Posts
    Hello

    this is my call of the snippet getfield:

    [!GetField? &docid=`38` &field=`[*image_layout_home*]`!]


    but it won't show the image that is put in the TV in id 38

    does anyone know what i do wrong?

    thanks
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Try it like this:
      [!getField? &docid=`38` &field=`image_layout_home`!]
        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
        • 39678
        • 68 Posts
        leaving the [* en *] in the field isn't a solution

        i think there is a problem with finding the docid 38
        if i took docid '1', then it works fine with field 'pagetitle'

        [!GetField? &id=`1` &field=`pagetitle`!]



        but this code also doesn't work:

        [!GetField? &id=`1` &field=`[*image_layout_home*]`!]



        so i think there are 2 problems: finding the docid and finding the field (Template variable) (*image_layout_home*]
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Is the snippet name getField or GetField?

          The &field property does not use the tags, only the name of the field (resource field or TV).

          According to the documentation, the resource to get the field from is &docid
          http://modx.com/extras/package/getfield
            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
            • 13428 ☆ A M B ☆
            • 1,031 Posts
            Is document 38 published?

            &field=`[*image_layout_home*]` is wrong in most cases. It should be &field=`image_layout_home`. [ed. note: Jako last edited this post 12 years, 6 months ago.]
              • 39678
              • 68 Posts
              now it is published smiley

              but this was a solution for a part.

              but now is the problem that the getfield doesn't look for the docid. It took just the TV of that page resource-id (I use the same TV on different resources with different content)

              image_layout_home is indeed the wright call, thanks.
                • 39678
                • 68 Posts
                hello,

                it is solved

                this is the correct code to get it working:

                [!GetField? &docid=`38` &field=`image_layout_home`!]


                And docid 38 must be published

                thanks for the help