We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22775
    • 15 Posts
    I'm doing an image-slider where the images-input uses MIGX. This works fine. As long as I only need images.
    In fact I also need text instead of images.
    Now I tried to set up MIGX to input an image or a text (headline and textfield). As I understood, this is the Advanced MIGX Configuration with Multiple Forms. Unfortunately I don't get this to work.
    Therefore I also tried the whole tutorial Varying layout-boxes. Even this doesn't work for me. I get an empty MIGX input-field in the manager and an output of an array in the frontend (not the fronted of the backend).

    Here I restarted.
    What I did:
    The MIGX aggregate TV contains this:
    form tabs:
    [
    {"caption":"Image", "fields":[
        {"field":"image","caption":"Bild","inputTVtype":"image"}
    ]},
    {"caption":"Text", "fields": [
        {"field":"title","caption":"Titel"},
        {"field":"inhalt","caption":"Inhalt","inputTVtype":"richtext"}
    ]}
    ]

    grid:
    [
    {"header": "Titel", "width": "160", "sortable": "true", "dataIndex": "title"},
    {"header": "Bild", "width": "50", "sortable": "false", "dataIndex": "image","renderer": "this.renderImage"}
    ]


    In the template I use this, which of course only shows the images:
     [[!getImageList? &tvname=`galleryMIGX` &tpl=`@CODE:<li><img src="dateien/[[+image]]" width="493" height="446" alt="Bild"></li>`]]


    Somewhere I need to put my template for the text:
    <li><div id="content"><h1>[[+title]]</h1>[[+inhalt]]</div></li>


    Could please someone advice me how to get further with this. I'm quite confused at the moment.
    MODX 2.2.10 and MIGX 2.5.6

    Thanks!
      • 4172
      • 5,888 Posts
      As allways, there are several ways.

      Two of them:

      1. Use an output-filter:

      [[!getImageList? &tvname=`galleryMIGX` &tpl=`tpl_galleryMIGX`]]


      chunk tpl_galleryMIGX:
      [[+title:isnot=``:then=`
      <li><div id="content"><h1>[[+title]]</h1>[[+inhalt]]</div></li>
      `:else=`
      <li><img src="dateien/[[+image]]" width="493" height="446" alt="Bild"></li>
      `]]


      2. switch chunk by field:

      formtabs:
      [
      {"caption":"Type", "fields":[
      {"field":"tpl","caption":"Type","inputTVtype":"listbox","inputOptionValues":"image==tpl_galleryMIGX_image||text==tpl_galleryMIGX_text"}
      ]},
      {"caption":"Image", "fields":[
          {"field":"image","caption":"Bild","inputTVtype":"image"}
      ]},
      {"caption":"Text", "fields": [
          {"field":"title","caption":"Titel"},
          {"field":"inhalt","caption":"Inhalt","inputTVtype":"richtext"}
      ]}
      ]


      [[!getImageList? &tvname=`galleryMIGX` &tpl=`@FIELD:tpl`]]


      two chunks:

      tpl_galleryMIGX_image
      <li><img src="dateien/[[+image]]" width="493" height="446" alt="Bild"></li>


      tpl_galleryMIGX_text
      <li><div id="content"><h1>[[+title]]</h1>[[+inhalt]]</div></li>



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

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 22775
        • 15 Posts
        Works perfect (I take the output-filter). Thank you so much.