We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35322
    • 20 Posts
    Okay, so, in SilverStripe, they have what they call Widgets. These widgets can be added in a given order to a Widgets field in the template. This is great for say, the right hand bar of this page. The top three items are one type of widget and the bottom two are another type, but all can be added in any order you wish, to a single field.

    I’d like, in ModX, to facilitate a similar feat. At the moment, I’m guessing I could do this by having a generic set of fields and allow the admin to select from a list of resources for laying out that data. Ultimately, though, what I’d like is for the fields to be specific to the resource, but I’m not yet seeing how this can be done without training the admin up on how to edit templates / chunks.

    So, my question was, could I create a dropdown field of resources in MigX, so that the admin could choose how to layout this data more simply and are there any examples of this?

    Thanks loads.

    Lee
      • 4172
      • 5,888 Posts
      I think I see.

      There are several ways to get this done in modx

      you can try the multipleForms-feature of MIGX
      http://rtfm.modx.com/display/ADDON/MIGX.Backend-Usage#MIGX.Backend-Usage-MultipleForms

      lets say you have some contact-resources and some other resources you want to link to.
      You can create two dynamic dropdown-TVs which lists them with names: ’contactDropdown’ and ’resourceDropdown’.
      You can use the resourcelist-TV or use the @EVAL or @SELECT - bindings for the input-options.


      Then create two different MIGX-Forms for this two different ’widgets’ with:

      [
      {"formname":"contacts", "formtabs":
      [
      {"caption":"Contact", "fields": [
      {"field":"resourceid","caption":"Contact","inputTV":"contactDropdown"}
      ]}
      ]
      },{"formname":"other", "formtabs":
      [
      {"caption":"Resources", "fields": [
      {"field":"resourceid","caption":"Resource","inputTV":"resourceDropdown"}
      ]}
      ]
      }]


      MIGX will switch between this forms when you change the form-dropdown.

      create two chunks for the frontend ’contacts’ and ’other’
      format this chunks for getResources.

      the ’contacts’ - chunk can look like that:

      <div class="WidgetHolder PersonelWidget first">
      	
      	<div class="personnelImage">
      <img alt="[[+pagetitle]]" src="[[+contactimage]]">
      <h4 style="padding: 0; margin: 0; font-weight: normal; color: #2d3380;">[[+pagetitle]]</h4>
      <a href="[[+contactmail]]">Email</a>
      </div>
      </div>
      


      and the ’other’ chunk:

      <div class="WidgetHolder LinkWidget">
      	
      	<a href="[[~[[+id]]]]">
      	<img alt="[[+pagetitle]]" src="[[+serviceimage]]">
      </a>
      
      </div>



      then create another chunk for getImageList ’widgets’
      in this chunk you can place a getResources-snippet-call or another custom-snippet to get the output for the selected resource with:
      [[getResources? &tpl=`[[+MIGX_formname]]` &resources=`[[+resourceid]]`]]


      and call getImageList with
      [[!getImageList? &tpl=`widgets` &tvname=`myMigxTv`]]
      


      something like this should work.

      you can create other Forms, where you can add your infos directly into the TV of course.

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

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 35322
        • 20 Posts
        Thank you, I’ll give that a try.

        Lee
          • 17422
          • 225 Posts
          I think about a possibility with the use of migx.

          Is it possible to integrate a migx in migx ? possibility to integrate "migx" in "migx" so unlimited

          exemple :

          [
              {"formname":"BlocType_1", "formtabs":
                  [
                      {"caption":"titre + photo + lien", "fields": [
                          {
                              [
                                  {"formname":"BlocType_4", "formtabs":
                                      [
                                          {"caption":"titre + photo + paragraphe + lien ", "fields": [
                                              {"field":"Titre_blocType_4","caption":"Titre"},
                                              {"field":"photo_blocType_4","caption":"Photo","inputTV":"image"},
                                              {"field":"lien_blocType_4","caption":"Lien"}
                                          ]}
                                      ]
                                  },
                                  {"formname":"BlocType_5", "formtabs":
                                      [
                                          {"caption":"titre + sous titre + photo + paragraphe + lien", "fields": [
                                              {"field":"Titre_blocType_5","caption":"Titre"},
                                              {"field":"paragraphe_blocType_5","caption":"Paragraphe","inputTV":"richtext"},
                                              {"field":"lien_blocType_5","caption":"Lien","inputTV":"url"}
                                          ]}
                                      ]
                                  }
                              ]
                          }
                      ]}
                  ]
              },
              {"formname":"BlocType_2", "formtabs":
                  [
                      {"caption":"titre + paragraphe + lien", "fields": [
                          {"field":"Titre_blocType_2","caption":"Titre"},
                          {"field":"paragraphe_blocType_2","caption":"Paragraphe","inputTV":"richtext"},
                          {"field":"lien_blocType_2","caption":"Lien","inputTV":"url"}
                      ]}
                  ]
              }
              ,
              {"formname":"BlocType_3", "formtabs":
                  [
                      {"caption":"titre + paragraphe + lien", "fields": [
                          {"field":"Titre_blocType_3","caption":"Titre"},
                          {"field":"paragraphe_blocType_3","caption":"Paragraphe","inputTV":"richtext"},
                          {"field":"lien_blocType_3","caption":"Lien","inputTV":"url"}
                      ]}
                  ]
              }
          ]
          
          



            • 4172
            • 5,888 Posts
            its not possible to have migx-TVs in migx-TVs at this time.
            It would need some work to make it possible.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 17422
              • 225 Posts
              thanks Bruno for your response
                • 9673
                • 52 Posts
                Please help me. I use MODx Revolution 2.0.8-pl (traditional), upgrade to 2.1 I can not. I will have compatibility issues with other snippets. Help me configure MIGX for 2.0.8.

                I created 3 TV:
                1) name "image" type - "image"
                2) name "richtext" type - "RichText"
                3) name "multiItemsGrid" type - "migx" (attach to the template)

                I have
                .../core/components/migx/examples/example.properties.before.2.1.js

                is

                [{"name":"formtabs","desc":"","xtype":"textarea","options":[],"value":"[{\"caption\":\"Info\", \"fields\": [{\"field\":\"title\",\"caption\":\"Title\"}, {\"field\":\"description\",\"caption\":\"Description\",\"inputTV\":\"richtext\"}]  }, {\"caption\":\"Image\", \"fields\": [{\"field\":\"image\",\"caption\":\"Image\",\"inputTV\":\"image\"}] }]","lexicon":null,"overridden":false,"desc_trans":"","menu":null},{"name":"columns","desc":"","xtype":"textarea","options":[],"value":"[{\"header\": \"Title\", \"width\": \"160\", \"sortable\": \"true\", \"dataIndex\": \"title\"}, {\"header\": \"Image\", \"width\": \"50\", \"sortable\": \"false\", \"dataIndex\": \"image\",\"renderer\": \"this.renderImage\"}]","lexicon":null,"overridden":false,"desc_trans":"","menu":null}]


                as a result I get the following picture


                I already spoke to you, you helped me with 2.1, I did similarly for 2.0.8. But this did not solve my problem.
                  • 9673
                  • 52 Posts
                  MIGX and multiItemsTv can be used simultaneously?
                    • 34459
                    • 134 Posts
                    Hi, I have a quite bizarre problem. I’ve made a MIGX TV with text fields and everything work’s fine. Problems started when I wanted to make a second one. It’s nearly a copy of the first one apart from 2 new images fields. (I’ve tried without but it’s not working either) Everything was based on the tutorial.

                    I’m running modx 2.1 and have it on-line if anybody would care to take a look:).
                      Check out blackflow.pl
                      • 4172
                      • 5,888 Posts
                      Quote from: blackflow at Jul 16, 2011, 07:41 AM

                      Hi, I have a quite bizarre problem. I’ve made a MIGX TV with text fields and everything work’s fine. Problems started when I wanted to make a second one. It’s nearly a copy of the first one apart from 2 new images fields. (I’ve tried without but it’s not working either) Everything was based on the tutorial.

                      I’m running modx 2.1 and have it on-line if anybody would care to take a look:).

                      should be no problem to have multiple MIGX-TVs. Which issues do you have? Can have a quick look, when you send me login-datas.
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!

                      This discussion is closed to further replies. Keep calm and carry on.