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

    The first scenario:
    Building a template "text.tpl" for text pages that contain a number of structurally similar text blocks, say blocks that consist of a heading and a list of items.

    The second scenario:
    Building a template "portfolio.tpl" for portfolio pages that present a number of product types, say type 1 through 4 - the first list. Each product type is presented by a thumbnail of an image that opens a gallery containing more images of the product type (the second list) when clicked. There is additionally a heading and a block of text or some other elements (a third list, potentially, but that one would not be nested into the second list, but stand next to it) next to the gallery thumbnail of the product type to be displayed.

    I have succeeded in the first scenario by putting a getResources call into the content field of the resource templated by "text.tpl" that collects the contents of subresources. Each subresource contains the heading and the list items (manually entered, including <li> </li> tags) of one text block. I am now looking to template the subresources so that I can add the items of the text block lists via MIGX. This should be fairly easy to do as long as I can keep getResources pulling the subresources inside. I just assume I can do that. Now my question.

    I wonder if I can use the MIGX way of adding items to the text lists for adding these same text blocks to the existing text blocks. This would, I think, look like a resource with a migx type TV that gives me an "add text block" button and in each grid line I find another button "add list item". Is something like that feasible at all? That would be a much nicer way of handling that list of lists, with no need for creating and handling many "sub-"resources.

    On to the second scenario. I have the following getResources call:
    [[!getResources? 
    &showHidden=`1` 
    &showUnpublished=`1` 
    &includeContent=`1` 
    &includeTVs=`1` 
    &processTVs=`1` 
    &sortby=`menuindex` 
    &sortdir=`ASC` 
    &tpl=`PF1` 
    &depth=`1` 
    &limit=`14` 
    &hideContainers=`1` ]]

    Then in the template chunk PF1, I want to place a MIGX call like the following:
    [[!getImageList? 
        &tvname=`PF1-Galerie`
        &tpl=`PF1-Galerie`
      ]]

    where the TV is of image type and the chunk looks approximately as follows, +image being the field that contains each image:
    <a href="[[+image]]" [[+_first:empty=`style="display:none"`]] class="zoom project_image"><img src="[[+image]]" alt="" class="" rel="colorbox" width="220px" height="150px"></a>

    I created a subresource and added some images to it via the PF1-Galerie TV.

    My question is why that doesn't work. Specifically, why the MIGX calls end up returning nothing. The getResources call otherwise works, as other stuff I put into PF1 does appear as usual. Can it be that getResources doesn't parse the getImageList snippet code or something? Otherwise, I have absolutely no clue. [ed. note: neo2.0 last edited this post 12 years, 8 months ago.]
      PHP illiterate MODx enthusiast
      • 4172
      • 5,888 Posts
      you need
      &docid=`[[+id]]`
      in your getImageList-call in a getResources-chunk, otherwise getImageList tries to get the value of the PF1-Galerie-TV of the main-resource, which is empty or non existent in your case.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 36565
        • 73 Posts
        Thank you very much, Bruno17! That property really did the trick!

        Now I have hope again that the combination of getResources and MIGX is the way to realize a whole lot of my MODx website dreams smiley

        But one mystery remains. It's the problem of the other thread of mine that you replied to earlier today, namely that all the images that MIGX gives via this method are the same. Here is the thread for convenience:
        http://ttyl.modx.com/thread/70031/migx-outputs-the-same-image-over-and-over#dis-post-392486

          PHP illiterate MODx enthusiast
          • 38556
          • 6 Posts
          My lord --- thank you. After searching for two hours and reading up and down.

          This worked for me to get MigX object with GetResources smiley

          [[!getResources? 
          &tpl=`getBottom` 
          &limit=`2` 
          &parents=`7`
          &includeContent=`1` 
          &includeTVs=`1`
          &processTVs=`1`
          &tvPrefix=``
          &sortby=`RAND()`
          ]]
          


          GetBottomTpl:

          <div class="bottenruta gradient">
          [[getImageList? 
          &tvname=`Extra_rightBar`
          &tpl=`rightBarTpl`
          &docid=`[[+id]]`
          ]]
          </div>


          rightBarTpl

          [[+image:isnot=``:then=`<img src="[[+image:phpthumbof=`w=298`]]" alt="[[+altText]]" title="[[+altText]]" style="margin-bottom:20px;"/>`]]
          <h2>[[+title]]</h2>
          [[+description]]
          [[+pdfLink:isnot=``:then=`<a href="[[+pdfLink]]" title="Ladda ner produktblad"`><h3>Ladda ner produktblad</h3></a>`]]


          Again ... thank you Bruno smiley
            Micke Pigment
            • 36830
            • 140 Posts
            Awesome.
              • 40568
              • 20 Posts
              Thanks Bruno! Adding this made it work for me too
              &docid=`[[+id]]`