We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • So after reading how to use MIGX with getResources and reading a few posts I finally managed to get it working but before I could start celebrating a small issue came up.

    MIGX is returning each image but it's only returning the pagetitle and content of the first record.

    Here is the page rendered with the tpl I'm using.

    http://thealogroup.com/teach-training-and-education/

    As you can see my tpl is being applied but it's not returning all the info for the second and third item.

    Here is another page without the tpl same exact getResources and MIGX calls.

    http://thealogroup.com/migx-no-tpl

    Here you can see my getResources call and MIGX are both returning all the data but for some reason when using the tpl it only works on the first MIGX record.

    Here is my getResources call:

    [[!getResources? 
    &parents=`[[*id]]`  
    &tpl=`getresources-migx-tpl` 
    &includeTVs=`1` 
    &processTVs=`1` 
    &includeContent=`1` 
    &showHidden=`1` 
    &limit=`0`]]
    


    This is my the getresources-migx-tpl:

    [[!getImageList? 
    &tvname=`migx-image-gallery` 
    &tpl=`migx-gallery-tpl` 
    &docid=`[[+id]]` 
    &limit=`1`]]
    


    And my migx-gallery-tpl:

     <li data-id="term-[[+idx]]" data-value="[[+pagetitle]]">
        <figure>
        	<img src="[[+project-image:phpthumbof=`w=230&h=230`]]" alt="[[+pagetitle]]" />
        	<div class="work_overlay">
        		<div class="work_title">
        			<h2><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h2>
        			[[+content]]
        			<a href="[[~[[+id]]]]"><div class="work_view" data-id="[[+idx]]"></div></a>
        		</div>									
        	</div>
        </figure>
    </li>
    


    Any help would be greatly appreciated.

    Thanks. [ed. note: benmarte last edited this post 11 years, 7 months ago.]
      Benjamin Marte
      Interactive Media Developer
      Follow Me on Twitter | Visit my site | Learn MODX
    • It looks like there is a template not shown above, when I look at that page with js off, the template doesn't look like the one you have above. Can you try outputting [[+id]] somewhere separate in the getresources-migx-tpl to make sure its a different id each time. It looks like its outputting the same id over and over to me.
      • Your right I posted the wrong tpl code, this is the correct one:

        
        <li data-id="term-[[+idx]]" data-value="[[+pagetitle]]">
            <figure>
            	<img src="[[+project-image:phpthumbof=`w=230&h=230`]]" alt="[[+pagetitle]]" />
            	<div class="work_overlay">
            		<div class="work_title">
            			<h2><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h2>
            			[[+content]]
            			<a href="[[~[[+id]]]]"><div class="work_view" data-id="[[+idx]]"></div></a>
            		</div>									
            	</div>
            </figure>
        </li>
        


        Thanks again
          Benjamin Marte
          Interactive Media Developer
          Follow Me on Twitter | Visit my site | Learn MODX
          • 4172
          • 5,888 Posts
          if you want to use fields of getResources in the MIGX-tpl you need to put them to the getImageList - call as properties like that:

          [[!getImageList?
          &tvname=`migx-image-gallery`
          &tpl=`migx-gallery-tpl`
          &docid=`[[+id]]`
          &limit=`1`
          &resid=`[[+id]]`
          &content=`[[+content]]`
          &pagetitle=`[[+pagetitle]]`
          ]]


          Then it should be possible to get them with

          <li data-id="term-[[+idx]]" data-value="[[+property.pagetitle]]">
              <figure>
                  <img src="[[+project-image:phpthumbof=`w=230&h=230`]]" alt="[[+property.pagetitle]]" />
                  <div class="work_overlay">
                      <div class="work_title">
                          <h2><a href="[[~[[+property.resid]]]]">[[+property.pagetitle]]</a></h2>
                          [[+property.content]]
                          <a href="[[~[[+property.resid]]]]"><div class="work_view" data-id="[[+idx]]"></div></a>
                      </div>                                   
                  </div>
              </figure>
          </li>



            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
          • That did it thanks for your help Bruno and this awesome plugin this needs to be included in the documentation I will put a request on the MODX Tracker.

            Thanks again.
              Benjamin Marte
              Interactive Media Developer
              Follow Me on Twitter | Visit my site | Learn MODX
              • 37032
              • 64 Posts
              Quote from: Bruno17 at Aug 29, 2012, 12:34 PM
              if you want to use fields of getResources in the MIGX-tpl you need to put them to the getImageList - call as properties like that:

              [[!getImageList?
              &tvname=`migx-image-gallery`
              &tpl=`migx-gallery-tpl`
              &docid=`[[+id]]`
              &limit=`1`
              &resid=`[[+id]]`
              &content=`[[+content]]`
              &pagetitle=`[[+pagetitle]]`
              ]]


              Then it should be possible to get them with

              <li data-id="term-[[+idx]]" data-value="[[+property.pagetitle]]">
                  <figure>
                      <img src="[[+project-image:phpthumbof=`w=230&h=230`]]" alt="[[+property.pagetitle]]" />
                      <div class="work_overlay">
                          <div class="work_title">
                              <h2><a href="[[~[[+property.resid]]]]">[[+property.pagetitle]]</a></h2>
                              [[+property.content]]
                              <a href="[[~[[+property.resid]]]]"><div class="work_view" data-id="[[+idx]]"></div></a>
                          </div>                                   
                      </div>
                  </figure>
              </li>




              Is the situation any different if you're using @CODE instead of a MIGX-tpl? Why I'm asking is because I'm using @CODE and can use the
              [[+pagetitle]]
              without declaring it in the MIGX call.

              Also. What is "&resid" can't find that in documentation?
                • 4172
                • 5,888 Posts
                you can not use @CODE in all situations, because of parsing order. For example when you are using output-filters like phpthumbof.
                They will not work, when using @CODE

                &resid was a example how you can add your own properties and use them in the chunk with
                [[+propery.yourownproperty]]


                In this case you could of course also use
                [[+property.docid]]
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 37032
                  • 64 Posts
                  Answering my own question:

                  MIGX doesn't behave the same way when using @CODE instead of a chunk based template. In one of my projects I changed from @CODE-tpl to a chunk based tpl and suddenly all my cache problems was gone. smiley

                  I still don't have to declare &pagetitle in the MIGX call to use it in my new template.
                    • 37032
                    • 64 Posts
                    Quote from: Bruno17 at Oct 10, 2012, 01:38 PM
                    you can not use @CODE in all situations, because of parsing order. For example when you are using output-filters like phpthumbof.
                    They will not work, when using @CODE

                    &resid was a example how you can add your own properties and use them in the chunk with
                    [[+propery.yourownproperty]]


                    In this case you could of course also use
                    [[+property.docid]]

                    Thanks for info Bruno. [ed. note: tomahl last edited this post 11 years, 6 months ago.]