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

    I have a slider using MIGX to input slides, however I need it to NOT display the last slide. The following code works when I manually enter the limit as 5, but when using the output filter [[+total:decr]] it stops any output. (Removing :decr will display all 6 slides). I basically need it to just knock 1 off the total!

    [[!getImageList?
    		&tvname=`homepage-slider`
    		&tpl=`slider-tpl`
    		&offset=`0`
    		&limit=`[[+total:decr]]`
    ]]
    


    Any help appreciated! Thanks
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      You could try calling the limit uncached as well, so [[!+total:decr]].
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 44649
        • 68 Posts
        Thanks for the suggestion, unfortunately no joy though. Is there a way to strip the last character from a TV output?
          • 24414
          • 45 Posts
          How about this as an output filter?

          return substr($input, 0, -1);
            • 1343 ☆ A M B ☆
            • 2,213 Posts
            Why not simply set the limit to 5 if that's what you are trying to accomplish, or simply not add the last slide in the first place?
              Patrick | Server Wrangler
              About Me: Website | Tweets |  MODX Hosting
              • 44649
              • 68 Posts
              Quote from: AMDbuilder at Sep 03, 2014, 11:21 PM
              Why not simply set the limit to 5 if that's what you are trying to accomplish, or simply not add the last slide in the first place?

              The way the slider works, each slide is divided by a comma and the client may want more than 5 sliders at some point. However if the last slide has a comma after in the JS it breaks the slider completely in IE7 & 8

              Quote from: ram at Sep 03, 2014, 02:32 PM
              How about this as an output filter?

              return substr($input, 0, -1);

              Thanks ram, I'll give this a try!
                • 4172
                • 5,888 Posts
                try this snippet:

                <?php
                
                $items = $modx->fromJson($value);
                return count($items)-1;
                


                use it like that:
                [[getImageList?
                        &tvname=`homepage-slider`
                        &tpl=`slider-tpl`
                        &offset=`0`
                        &limit=`[[getLimit? &value=`[[*homepage-slider]]`]]`
                ]]

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

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 44649
                  • 68 Posts
                  Thanks Bruno, that worked a treat!