We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37480
    • 9 Posts
    Hey,

    can anyone tell me how to use inheritance with the migx TV?

    I use migx to save multiple pictures for a slideshow in the page header. I tried to use @INHERIT as default value, but the migx TV doesn't use it...

    Thanks,
    Martin
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can use another Textarea type TV with something like this as its default
      <ul>
        [[!getImageList?
          &docid=`1`
          &tvname=`Images`
          &tpl=`@CODE:<li>[[+idx]]<img src="[[+image]]"/><p>[[+title]]</p></li>
        `]]
      </ul>

      Note the &docid property.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 37480
        • 9 Posts
        Hi,

        works like a charm...I combined it with the "UltimateParent" as docid. Still this approach is not very enduser-friendly. I think about using a dropdown to select the resource from which to inherit the code. Here I could also use a fix default value or the UltimateParent again.

        It would be nice if it was possible just to use @INHERIT....

        But thanks a lot....It's a good solution for now...

          • 28042 ☆ A M B ☆
          • 24,524 Posts
          MIGx TVs aren't like other TVs. They have their output displayed by snippet, not automatically as standard MODx TVs do. The MIGx TV data is stored as a JSON string, so it has to be unpacked and run through a tpl. I don't see how that could be dealt with using @INHERIT.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 37480
            • 9 Posts
            Maybe it's possible to check the parents JSON string, if the JSON string is of the resource is empty and the default value is set to @INHERIT. I suppose this should be done in the snippet which computes the output.

            The workaround works fine, but it's not the best thing for the users....If I find some time I'll have a deeper look at it!
              • 4172
              • 5,888 Posts
              Does it work this way, when having default-value: @INHERIT ?

              <ul>
                [[!getImageList?
                  &tvname=`Images`
                  &value=`[[*Images]]`
                  &tpl=`yourTpl`
                `]]
              </ul>
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 37480
                • 9 Posts
                Quote from: Bruno17 at Oct 08, 2013, 07:47 AM
                <ul>
                  [[!getImageList?
                    &tvname=`Images`
                    &value=`[[*Images]]`
                    &tpl=`yourTpl`
                  `]]
                </ul>

                No doesn't work. Do I have to change something on the migx-TV? Output-Type?
                  • 38021
                  • 7 Posts
                  I had issue with that too... remember you can use @SELECT:

                  If I want to set default values for example from document 1, and my migx template variable is id 27, I'll put this in the default value field:
                  @SELECT `value` FROM `modx_site_tmplvar_contentvalues` WHERE `tmplvarid`='27' AND `contentid`='1'

                  Note that ofc this doesn't really INHERIT, as it's from a specific ressource id.
                    • 19328
                    • 433 Posts
                    just wanted to say thanks alain-hki, your solution is perfect for my situation!