We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46971
    • 33 Posts
    I have the following migx-tpl code:
    <img src="[[+projekt-images]]" ... />
    [[+projekt-description]]

    First: How can i add an if-condition? something like:

    [[IF [[+projekt-images]] is:not empty then: <img src="[[+projekt-images]]" class="img-responsive section-sm center-block" alt="" title="" />]]
    [[IF [[+projekt-description is:not empty then: [[+projekt-description]]]]


    Second: How can i nest my migx with radio-buttons that gives a specific tv. A migx tv that is something like:

    Choose: [·] TEXT [ ] IMAGE

    If TEXT is chosen, then the migx should add a textfield that the user can fill in. But if IMAGE is chosen, the textfield is not visible but an image can be chosen. I hope you understand me smiley

    Thank you!

    This question has been answered by multiple community members. See the first response.

    [ed. note: dsquare last edited this post 10 years, 10 months ago.]
    • discuss.answer
      • 46971
      • 33 Posts
      Finally i found the documentation "Input and Output Filters" and there is one solution that works for me in the tpl-chunk:

      [[+projekt-images:isnot=``:then=`<img src="[[+projekt-images]]" ... />`]] 
      [[+projekt-description:isnot=``:then=`[[+projekt-description]]`]] 


      Now the next hours i am going to search for the solution for point 2, the nested if-statemented migx-tvs!
      • discuss.answer
        • 4172
        • 5,888 Posts
        with point 2, I think you are talking about multiple formtabs.
        Possible to set them up with the MIGX - configurator
        https://rtfm.modx.com/extras/revo/migx/migx.tutorials/migx.varying-layout-boxes/migx.varying-layout-boxes.configurator-version

        or without configurator:

        https://rtfm.modx.com/extras/revo/migx/migx.tutorials/migx.varying-layout-boxes
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 46971
          • 33 Posts
          Yes, multiple formtabs! I try to get through it for some hours. With the "visual" building of formtabs by editing (not raw editing) i have my first success smiley Raw editing is a way too hard by now cause i don't understand how to change the code to affect what i need.

          Thank you again!
            • 46971
            • 33 Posts
            Okay, everything works fine beside one problem. The output of the image is only the name of the image. I don't understand how the paths/urls works in general in modx. Sometimes i get a relative path (like in this case) "assets/img/filename.jpg" and sometimes i only get the filename without the tw relative folders in front.

            What do i need to do?

            I want that:
            <img src="[[+projekt-single-image]]" ... />

            to become this:
            <img src="[b]assets/img/[/b]filename.jpg" ... />


              • 4172
              • 5,888 Posts
              if, you have asigned a mediasource to an image-TV, only the path relative to the mediasource-path makes it to the db.
              Normaly the path is added, when the TV gets processed.

              getImageList respects the mediasource-path, when the MIGX-field has a mediasource correctly asigned and when it has a chance to figure the asigned mediasource for that field.

              If thats not the case for some reason, you can add the path manually in your tpl.

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

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 46971
                • 33 Posts
                How should i assign the correct mediasource? i did the following:
                field: projekt-single-image / mediasources: migx, context: project, source (id): assets/img/portfolio/

                is this right? so i want to get "assets/img/portfolio/filename.jpg".

                Under manager configuration - filesystem, i have relative paths on.
                Under mediasources (not migx) i got one "projects" with the same path and url: assets/img/portfolio/ and this works with other tvs. relative paths here are also on, too.

                Because i just saw the "source ID", i've tried to put in the ID from the mediasources (not migx) to the migx. So instead of source id: assets/img/portfolio/ i just put in the id/number "3". But this does not work either. [ed. note: dsquare last edited this post 10 years, 10 months ago.]
                  • 4172
                  • 5,888 Posts
                  could you post an export of your MIGX - configuration, please
                  and your getImageList - call
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 46971
                    • 33 Posts
                    My getImageList call:
                    [[!getImageList? &tvname=`migx-projekt-items` &tpl=`migx-projekt-items-tpl`]]


                    And i hope this was the right way to export the migx config/code, that i did not code manually but by the "visual" configuration field by field. In this config the last try to put in the modx mediasources id number "3" is visible (last paragraph of my post before):

                    {
                      "formtabs":[
                        {
                          "MIGX_id":28,
                          "caption":"Item-Typ ausw\u00e4hlen",
                          "print_before_tabs":1,
                          "fields":[
                            {
                              "MIGX_id":74,
                              "field":"fake",
                              "caption":"",
                              "description":"",
                              "description_is_code":"0",
                              "inputTV":"",
                              "inputTVtype":"",
                              "validation":"",
                              "configs":"",
                              "restrictive_condition":"",
                              "display":"none",
                              "sourceFrom":"config",
                              "sources":"",
                              "inputOptionValues":"",
                              "default":"",
                              "useDefaultIfEmpty":"0",
                              "pos":1
                            }
                          ],
                          "pos":1
                        },
                        {
                          "MIGX_id":31,
                          "caption":"Projektbild",
                          "print_before_tabs":"0",
                          "fields":[
                            {
                              "MIGX_id":72,
                              "field":"projekt-single-image",
                              "caption":"Projektbild ausw\u00e4hlen",
                              "description":"",
                              "description_is_code":"0",
                              "inputTV":"",
                              "inputTVtype":"image",
                              "validation":"required",
                              "configs":"",
                              "restrictive_condition":"",
                              "display":"",
                              "sourceFrom":"migx",
                              "sources":[
                                {
                                  "MIGX_id":1,
                                  "context":"project",
                                  "sourceid":3
                                }
                              ],
                              "inputOptionValues":"",
                              "default":"",
                              "useDefaultIfEmpty":"0",
                              "pos":1
                            },
                            {
                              "MIGX_id":73,
                              "field":"projekt-single-image-alt",
                              "caption":"Alternativtext",
                              "description":"alt-tag for this image",
                              "description_is_code":"0",
                              "inputTV":"",
                              "inputTVtype":"",
                              "validation":"",
                              "configs":"",
                              "restrictive_condition":"",
                              "display":"",
                              "sourceFrom":"config",
                              "sources":"",
                              "inputOptionValues":"",
                              "default":"",
                              "useDefaultIfEmpty":"0",
                              "pos":2
                            }
                          ],
                          "pos":2
                        }
                      ],
                      "contextmenus":"",
                      "actionbuttons":"",
                      "columnbuttons":"",
                      "filters":"",
                      "extended":{
                        "migx_add":"Projekt-Item hinzuf\u00fcgen",
                        "disable_add_item":"",
                        "add_items_directly":"",
                        "formcaption":"Auswahl",
                        "update_win_title":"Projekt-Item",
                        "win_id":"form-projekt-bild",
                        "maxRecords":"",
                        "addNewItemAt":"bottom",
                        "multiple_formtabs":"7||6",
                        "multiple_formtabs_label":" ",
                        "multiple_formtabs_field":"",
                        "multiple_formtabs_optionstext":"Bild",
                        "multiple_formtabs_optionsvalue":"",
                        "actionbuttonsperrow":4,
                        "winbuttonslist":"",
                        "extrahandlers":"",
                        "filtersperrow":4,
                        "packageName":"",
                        "classname":"",
                        "task":"",
                        "getlistsort":"",
                        "getlistsortdir":"",
                        "sortconfig":"",
                        "gridpagesize":"",
                        "use_custom_prefix":"0",
                        "prefix":"",
                        "grid":"",
                        "gridload_mode":1,
                        "check_resid":1,
                        "check_resid_TV":"",
                        "join_alias":"",
                        "has_jointable":"yes",
                        "getlistwhere":"",
                        "joins":"",
                        "hooksnippets":"",
                        "cmpmaincaption":"",
                        "cmptabcaption":"",
                        "cmptabdescription":"",
                        "cmptabcontroller":"",
                        "winbuttons":"",
                        "onsubmitsuccess":"",
                        "submitparams":""
                      },
                      "columns":""
                    }
                      • 4172
                      • 5,888 Posts
                      "sourceFrom":"migx",
                      

                      should be

                      "sourceFrom":"config",


                      since you are setting the mediasource by configuration.
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!