We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9149
    • 19 Posts
    I cannot believe how many hours I have spent trying to troubleshoot this problem, and it is holding up my entire project. Any help would be greatly appreciated. (Please note that I have read dozens of articles and forum posts about this issue and I have tried EVERYTHING in an attempt to get this working to no avail.)

    SITUATION
    I have a section container page [id=2] in which I want to display a selection of information from child resources contained within it (which all use the same template).

    APPROACH
    I am using a getResources query inside a chunk named [[$agentsList]] that is then embedded in the page to display the content according to a template named [[$agentSnapshot]] contained within a separate chunk.

    RESULTS/PROBLEM
    Everything works EXCEPT the TVs. NO TV will load, regardless of what it contains. I have even tried this with a blank template and nothing else, and the TVs simply will not load.

    TV NAME
    tv.agentPhoto


    This TV has an "image" input type and "image" output type--and I have tried this with "image" input type and "default" and "text" output types, with no luck. It should go without saying that the images are actually in the filesystem and they appear if I call them from static HTML directly.

    GETRESOURCES QUERY ( contained within chunk [[$agentsList]] )

    [[!getResources? &parents=`2` &limit=`15` &processTVs=`1` &includeTVs=`1` &includeContent=`1` &tpl=`agentSnapshot` &sortBy=`id` &sortdir=`ASC`]]


    I have also tried including &tvPrefix=`tv.` / &prepareTVs=`1` / &prepareTVList=`tv.agentPhoto` / &processTVList=`tv.agentPhoto` and NONE of them made any difference.

    TEMPLATE CHUNK ( contained within chunk [[$agentSnapshot]] )

    <div class="small-12 medium-6 large-4 columns">
        <img src="[[+tv.agentPhoto]]" alt="[[+pagetitle]]">
        <div class="panel">
            <h5>[[+pagetitle]]</h5>
            <h6 class="subheader"><a href="[[~[[+id]]]]" title="Full bio for [[+pagetitle]]">Full bio</a></h6>
        </div>
    </div>
    


    The output looks like this:

    <div class="small-12 medium-6 large-4 columns">
        <img src="" alt="Jane Smith">
        <div class="panel">
            <h5>Jane Smith</h5>
            <h6 class="subheader"><a href="jane-smith.html" title="Full bio for Jane Smith">Full bio</a></h6>
        </div>
    </div>
    


    I hope this is clear and that someone can help me out. If it is relevant, I am developing on Mac OS X 10.10 using MAMP Pro with PHP 5.5.18 and MySQL.

    Thanks,
    Michael [ed. note: etherweave last edited this post 11 years, 11 months ago.]
      • 3749
      • 24,544 Posts
      Try this:

      &tvPrefix=``


      The default prefix is tv. so if you're TVs don't look like this: tv.tvname, and you don't specify an empty prefix, they won't be found.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        It looks as if you have named your TV 'tv.agentPhoto'.

        That may be your problem. Just name the TV 'agentPhoto'. It is referred to in the getResources chunk tpl as 'tv.agentPhoto' if 'tv' is the default TV prefix for getResources tpls. The prefix is for getResources internal processing, not for the actual TV's name.

        Having tv. actually be in the name of the TV itself is confusing things.

        Or, of course, you can name the TV tv.agentPhoto, then specify an empty prefix for getResources, as BobRay suggested, but that's kind of redundant.
          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
          • 9149
          • 19 Posts
          Quote from: sottwell at Oct 30, 2014, 12:14 AM
          It looks as if you have named your TV 'tv.agentPhoto'.

          That may be your problem. Just name the TV 'agentPhoto'. It is referred to in the getResources chunk tpl as 'tv.agentPhoto' if 'tv' is the default TV prefix for getResources tpls. The prefix is for getResources internal processing, not for the actual TV's name.

          Having tv. actually be in the name of the TV itself is confusing things.

          Or, of course, you can name the TV tv.agentPhoto, then specify an empty prefix for getResources, as BobRay suggested, but that's kind of redundant.

          Problem solved! You were absolutely right--and it was a combination of a couple of things that tripped me up. Now that I get it, I'm amazed at how unclear the official documentation is, but it explains all the confusion I have found online about this particular feature.

          So, to be clear, here's what I have done to get this to work properly (for the benefit of those like me who may find this thread later):

          1. My TV now has a standard, non-prefixed name: [[*agentPhoto]]. The TV itself is an image, and the input type and output type are both "image."
          2. My getResources query (above) did not change.
          3. My getResource template, [[$agentsList]], was modified to change this:

          <div class="small-12 medium-6 large-4 columns">
              <img src="[[+tv.agentPhoto]]" alt="[[+pagetitle]]">
              <div class="panel">
                  <h5>[[+pagetitle]]</h5>
                  <h6 class="subheader"><a href="[[~[[+id]]]]" title="Full bio for [[+pagetitle]]">Full bio</a></h6>
              </div>
          </div>


          to this:

          <div class="small-12 medium-6 large-4 columns">
              [[+tv.agentPhoto]]
              <div class="panel">
                  <h5>[[+pagetitle]]</h5>
                  <h6 class="subheader"><a href="[[~[[+id]]]]" title="Full bio for [[+pagetitle]]">Full bio</a></h6>
              </div>
          </div>


          (I am not embedding the TV placeholder inside an <img> tag.)

          ...and all is well.

          As sottwell pointed out--and this is something that really is NOT clear in any documentation or other forum threads--the use of the "tv." prefix is PURELY for getResources' own internal processing--it is NOT a requirement that your TVs have this prefix in their name unless you want that for some reason, but you must specify "tv." as the prefix when calling a TV from a getResources template. (At least, in this instance, that's the only approach that worked for me.)

          Thank you again for your help. You've made my day!

          Michael
            • 4172
            • 5,888 Posts
            Additional Note:

            If you want to have more control by yourself, do not use the output-type image for your image-TV, but the default-one and let it as it was:

            <img src="[[+tv.agentPhoto]]" alt="[[+pagetitle]]">
            


            this way, you can use the pThumb - outputfilter on your images to minimize them on the fly.


            <img src="[[+tv.agentPhoto:phpthumbof=`w=200`]]" alt="[[+pagetitle]]">
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!