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

    I need my [[+idx]] tv to start at 0 instead of 1 so i tried this :
    [[+idx:decr]] or [[+idx:substract=`1`]] but it gives me -1 (minus one).
    Does anyone knows an other way to obtain 0 ?
    Thank you
      • 24629
      • 370 Posts
      So if you make a listing of each of your notations you get this?
      [[+idx]] = 1,2,3,4,5,6
      [[+idx:substract=`1`]] = -1,0,1,2,3,4
      id that correct?
      You could try making a snippet to increment?
      <%php
        return idx+1;

      and calling it with
      [[MySnippet? &idx=`[[+idx]]`]]


      Ralph
      • <%php

        Your asp habit is showing wink
          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
        • Thank you very much rdaneeel, i've tried to increment with a snippet but it gives me (+)1. It seems like 0 does not exists.
          Is there a way to do something like that in a snippet :
          if ([[+idx]]==1)
            echo "0";
          [ed. note: hartus last edited this post 11 years, 1 month ago.]