'ello all.

I bet that title looks a bit fierce.

In all reality, I just need to use a section to go from 2007 to 1900 in a options loop.

This is what I have ... I just need the reverse of it.

$yearLoopEnd = 2007

{section name="yearLoop" start=1900 loop=$yearLoopEnd step=1}

TIA!

    {section name="yearLoop" start=$yearLoopEnd loop=1900 step=-1} 

    ?

      Nah, then it goes from 1899 to 0 :o

        Dunno smarty, but can't you use a while loop instead?

          Well, I read the smarty documentation for the section function, and found that you can specify the max # of times it should step through the loop. Now, I don't have Smarty, so I can't test this, but I'm wondering if you can't do some arithmetic perhaps?

          {section name="yearLoop" loop=$yearLoopEnd max=($yearLoopEnd - 1900) step=-1} 

          If not, you might have to either a) specify a number for max, or b) use a for() loop to manually output the years:

          for($i = date('Y'); $i >= 1900; $i++)
              echo "<option value=\"$i\">$i</option>\n";
            Write a Reply...