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

    Yes I get an image with:

    <img src="[[*image]]"/>


    Curious...

    Zaphodx
      • 8323
      • 14 Posts
      Hello there,

      Indeed amazing add-on. Thank you Bruno!

      Question:
      I have two divs where I output two lists of different data from the same MIGX tv.
      Basically one div gets text from one field and second from another. Fields are related to each other (that’s why only one tv).

      To make it more useful in this particular situation I wanted to randomize their order. The problem is, I have to output those in two different places in the code, so I call getImagesList two times but randomize obviously gives different order every time it’s called and I want to keep same order in both lists (but still randomized). To make it even clearer:

      1) This is what I have by default:
      [table][tr][td]1-1[/td][td]2-2[/td][td]3-3[/td][td]4-4[/td][td]5-5[/td][/tr][/table]

      2) This is what I get by using randomize on two calls (example):
      [table][tr][td]1-3[/td][td]5-2[/td][td]2-1[/td][td]4-4[/td][td]3-5[/td][/tr][/table]

      3) This is what I want to achieve (example):
      [table][tr][td]1-1[/td][td]5-5[/td][td]2-2[/td][td]4-4[/td][td]3-3[/td][/tr][/table]

      Any simple ideas?
        • 33379
        • 110 Posts
        Grzegorz Widla - Hi,

        Depending on what you aee trying to achieve, you could try one of the following:

        1. Use one call to getImagesList with two divs (so your related content doesn’t get split up) in your Tpl which can be positioned where you want them with CSS.

        2. Make one of the divs in your Tpl "hidden" with CSS and use a little snippet to put the output content where you want it elsewhere on the page or into another TV that you can call where you want it?

        Hope these ideas might point you in the right direction.

        Cheers - Zaphodx.
          • 33379
          • 110 Posts
          Hi Bruno,

          I solved it! Nothing to do with paths, I had the Template Access for the "image" and "richtext" TVs ticked on for the template I am using, unchecking them made the image appear (the "richtext" one didn’t affect it, but I unchecked it anyway). It might be worth noting in the documentation that the Template Access should be left unchecked for these "sub" TVs.

          It works and looks great, many thanks for this fabulous extra and for your input on this, it is much appreciated.

          Cheers - Zaphodx smiley
            • 4172
            • 5,888 Posts
            Quote from: Grzegorz at Jun 06, 2011, 09:02 AM

            Hello there,

            Indeed amazing add-on. Thank you Bruno!

            Question:
            I have two divs where I output two lists of different data from the same MIGX tv.
            Basically one div gets text from one field and second from another. Fields are related to each other (that’s why only one tv).

            To make it more useful in this particular situation I wanted to randomize their order. The problem is, I have to output those in two different places in the code, so I call getImagesList two times but randomize obviously gives different order every time it’s called and I want to keep same order in both lists (but still randomized). To make it even clearer:

            1) This is what I have by default:
            [table][tr][td]1-1[/td][td]2-2[/td][td]3-3[/td][td]4-4[/td][td]5-5[/td][/tr][/table]

            2) This is what I get by using randomize on two calls (example):
            [table][tr][td]1-3[/td][td]5-2[/td][td]2-1[/td][td]4-4[/td][td]3-5[/td][/tr][/table]

            3) This is what I want to achieve (example):
            [table][tr][td]1-1[/td][td]5-5[/td][td]2-2[/td][td]4-4[/td][td]3-3[/td][/tr][/table]

            Any simple ideas?


            I could add view lines to getImageList, so it would be possible to output the randomized items as json into a placeholder and use this placeholder in
            &outputvalue=`[[+randomizedJson]]`
            for both snippet-calls
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 4172
              • 5,888 Posts
              ok, with the latest snippet on github you can output the randomized and filtered items as json again to a placeholder with

              &toJsonPlaceholder=`jsonoutput`

              in the snippetcall

              then you can use that json in &value=`[[+jsonoutput]]` for other getImageList-calls.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 4172
                • 5,888 Posts
                Uploaded a new Version of MIGX with some new features - see also wiki

                Some of them:


                • Preview window
                • switch Form and tpls
                • some new properties for getImageList

                Hope you can download it soon from Extras-Repository or Package-Management and try it out.
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 8323
                  • 14 Posts
                  Thank you Bruno!
                  Great job, does what I needed smiley

                  I noticed issue in documentation here http://rtfm.modx.com/display/ADDON/MIGX.Frontend-Usage
                  "example: &toJsonPlaceholder=`jsonoutput` -> [[getImagelist? &outputvalue=`[[+jsonoutput]]`................]]"
                  Obviously other calls doesn’t use &outputvalue parameter but &value.

                  Below is case of use example:
                        [[!getImageList?
                             &tvname=`customers`
                             &randomize=`1`
                  	   &toJsonPlaceholder=`jsonoutput`
                        ]]
                        <div id="customerLogoHolder">
                        [[!getImageList?
                             &value=`[[+jsonoutput]]`
                  	   &tpl=`tplCustomers`
                        ]]
                        </div>
                        <div id="customerNavigation">
                  	   <a href="#" class="prev">PREVIOUS</a>
                  	   <a href="#" class="next">NEXT</a>
                        </div>
                        <div id="customerTestimonyHolder">
                        [[!getImageList?
                  	   &value=`[[+jsonoutput]]`
                  	   &tpl=`tplQuotes`
                        ]]
                        </div>
                  
                    • 4172
                    • 5,888 Posts
                    I noticed issue in documentation here http://rtfm.modx.com/display/ADDON/MIGX.Frontend-Usage
                    "example: &toJsonPlaceholder=`jsonoutput` -> [[getImagelist? &outputvalue=`[[+jsonoutput]]`................]]"
                    Obviously other calls doesn’t use &outputvalue parameter but &value.

                    Thanks! Corrected.
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 23018
                      • 353 Posts
                      Hi there,

                      I’m experimenting with checkboxes and for the moment I’m stuck with a small problem that I could solve with a custom snippet but I’m sure there is an easier way to do that.

                      Edit: No, I can’t, see below sad

                      I have a number of checkboxes inside one of my MIGx TVs.

                      For example:

                      TV Name: colors
                      Option Values: Red==red||Blue==blue||Yellow==yellow
                      


                      If I simply use [[+colors]], getImageList will return "array" as a result. Yet, what I want to get is a list of checked values (comma separated would be even better):

                      Example: I have checked "Red" and "Blue" and want to have:

                      red,blue


                      as a result.

                      Am I missing something?

                      Regards,

                      pepebe

                      Edit: Is there something like an output filter capable to handle one-dimensional arrays?

                      Edit: What’s very confusing for me is the fact that I don’t have a problem to output TVs that have only one of the options checked. Example: If the only value checked is "Blue" for example, [[+colors]] will output "blue". Shouldn’t be the content of any checkbox TV always be an array, even if it is empty?


                      Yeah, I’m missing something: I don’t have an array, the whole thing is stored as JSON... I’ll study the code an brew something that get’s me what I want.

                      Edit: This is getting really frustrating. I’m stuck and very confused...

                      If I add [[*myTv]] to a template or chunk, I get a neat json object with all the information inside my MIGx TV.

                      So far so good.

                      The return value of a TV with checkboxes or multiselect is either

                      - none if empty,
                      - a simple value if only one item is selected or
                      - "array" if more than one item is selected.

                      I don’t know where "Array" comes from because it doesn’t seem to be an array. If I send the output to a snippet and print_r it, I don’t get any result. "is_array($input)" also returns false.

                      Changing the output value of a checkbox TV to a commas delimited list or any other type also doesn’t help.

                      I really think that I’m missing something FUNDAMENTAL here.

                      Please, anyone give me clue how to handle this.

                      Regards,

                      pepebe.
                        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe

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