Is there no way to pass variables by reference to a modifier? It would seem the usefulness of this function would be greatly expanded if this were possible. I tried adding "&" to the $number parameter to no effect.

(Note a little bug in joscha's if you want to use that one: "smarty_modifier_pp" should be "smarty_modifier_id")

The simplest solution would probably be to use "counter". There would be different ways to do this depending on your desired outcome and your preferences for appearance/functioning inside of the template.

If you had to have the same value reused (e.g., within the value as well as the name in the drop down) and you wanted to print out both, you could do: