We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38669
    • 51 Posts
    Hey there, maybe someone can answer this.

    I have a template with an image TV shopimage. If I create a resource using this template and call the TV I can see the image as expected. So far so good.

    Now I am trying to build a list of resources, think of it as being like the listing for a blog, using getresources. On the parent page I want to show the image from the TV as part of each listing. To clarify, imagine a list of blog posts with a thumbnail, the thumbnail being the image in the TV.

    The chunk I am using as a template (shopTpl) looks like this;

    <div class="shopitem">
    <div class='shopitemimage'>[[*shopimage]]</div>
        <div class="shopitemtitle">[[+pagetitle]]</div>
         <div class="shopiteminfo">
        [[+introtext]]
        </div>
    </div>


    Here's my getresources call;

    [[!getResources?  &tpl=`shopTpl` &parents=`[[*id]]` &includeContent=`1` &includeTVs=`1`]] 


    Nothing is returned from the TV at all, but the pagetitle and introtext are there.

    What am I missing? Thanks in advance

    Bonus points: If I add *content instead of +introtext it completely breaks...why is that?
      • 22840
      • 1,572 Posts
      Try this for your chunk:

      <div class="shopitem">
      <div class="shopitemimage"><img src="[[+shopimage]]" alt="[[+pagetitle]]" /></div>
          <div class="shopitemtitle">[[+pagetitle]]</div>
           <div class="shopiteminfo">
          [[+introtext]]
          </div>
      </div>


      And for the call:

      [[!getResources?  &tpl=`shopTpl` &parents=`[[*id]]` &includeContent=`1` &includeTVs=`1` &processTV=`1`]]


        • 38669
        • 51 Posts
        Thanks PaulP

        Still nothing
        <div class="shopitemimage"><img src="" alt="page title" /></div>


        I had already tried with the img tags, and had also already tried the processTV.
          • 4172
          • 5,888 Posts
          Bonus points: If I add *content instead of +introtext it completely breaks...why is that?

          This:
          [[*....]]

          is replaced by fields and TVs of the current Resource.

          This:
          [[+....]]

          is replaced by placeholder-vars. In this case placeholder-vars, which are generated by getResources for each listed Resource

          if you add
          [[*content]]
          and this breaks everything, you may run into a infinite loop, if you have getResources in the content with its own content-field in it. [ed. note: Bruno17 last edited this post 11 years, 6 months ago.]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 4172
            • 5,888 Posts
            you should try

            [[+tv.shopimage]]
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 38669
              • 51 Posts
              Couple of other things I have tried with no luck is inputting TV as an image and outputting as text. Again, if I view the actual resource, I see the output as expected. But it seems that when it passes through the chunk it gets "lost".
              • You need to change your chunk to this like Bruno said:

                <div class="shopitem">
                <div class='shopitemimage'>[[+tv.shopimage]]</div>
                    <div class="shopitemtitle">[[+pagetitle]]</div>
                     <div class="shopiteminfo">
                    [[+introtext]]
                    </div>
                </div>
                


                Make sure you have includeTvs and processTvs in your getresource call set to 1 and leave the TV output as default.
                  Benjamin Marte
                  Interactive Media Developer
                  Follow Me on Twitter | Visit my site | Learn MODX
                  • 38669
                  • 51 Posts
                  +1 smiley

                  Thanks Bruno and Benmarte.

                  Can you explain why that works but the regular TV link doesn't?
                    • 38669
                    • 51 Posts
                    Ahhh.....and yes Bruno, that seems to have been the problem with content.

                    Because I had in the getresources call &includeContent=`1` and was then using *content it likely was infinite looping. I removed &includeContent=`1` and BINGO.

                    Thanks so much for your help...ModX can be bloody confusing, but very powerful.