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

    for my Site I use the plugin MIGX to became a background-slider.
    But when my customer only made 1 data set, then I need a special value in my jQuery-Script.

    So I need a outputfilter for migx, which allowed me to say if(dataset < 1){ ...}else{}

    Is there any way to make this?
    I've searched a long time, but nothing found for that problem…

    Hope you can help me.

    Kind regards,
    z.

    This question has been answered by Bruno17. See the first response.

      • 19369
      • 1,098 Posts
      If you have some kind of class for each slide, maybe you can count them with jQuery and add a code when the class count is < than 2.
        • 38537
        • 34 Posts
        No, that doesn't work for me. I need the value before the DOM is ready.
        Also I think I don't need a outputfilter. I think it's more a snippet, which let me count how many data sets for the actual ID is there…

        Sorry for my bad english wink
          • 4172
          • 5,888 Posts
          getImageList sets a totalvar-placeholder. default is
          [[+total]]


          its also easy to create an output-filter:

          <?php
          $items = $modx->fromJSON($input);
          return count($items);


          use it this way:

          [[*migxTV:countJsonItems]]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 38537
            • 34 Posts
            Sorry, but I don't understand anything.

            What I want:
            Im on a site. This site has a MIGX-TV. And the customer create 3 datasets.

            So, I need the number, how many datasets are in my TV.

            And then I wanny write in my snippet
            <?php
            if(count < 1){
            	return 'bla';
            }else{
            	return 'blub';
            }
            ?>
              • 38537
              • 34 Posts
              @Bruno17
              Thanks for your reply, but I have no idea, how I can use your code for my problem. I need a more detailed explanation…
                • 4172
                • 5,888 Posts
                create a snippet

                <?php
                $items = $modx->fromJSON($input);
                if(count($items) < 2){
                    return 'bla';
                }
                
                return 'blub';


                call it
                [[yourSnippet? &input=`[[*MIGXtv]]`]]

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

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 38537
                  • 34 Posts
                  Hmh no, that doesn't work for me.
                  I test the values with
                  return count($items);

                  and on every page I became the value 1. But that isn't correct. On my startpage I have 3 datasets. On a other page I have 4 and so on…
                  But the script return everytime the value 1…
                    • 4172
                    • 5,888 Posts
                    what's the output of your MIGX-TV when you put its TV-tag into your template?

                    [[*yourMIGXTV]]
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 38537
                      • 34 Posts
                      Then I become an array:
                      [{"MIGX_id":"1","title":"Image 1","image":"files/tmp/tunnel.jpg"}]