1

I would like to know whether it is possible to add a zero before single digits on smarty.

Normaly in PHP when i add below code it will count from 1-9 with a zero (Ex: 01, 02, 03 so on)

printf("%02d", $i++);

But with im not sure how to apply this. Smarty {counter} will simply count 1, 2, 3 etc.

Any advice is highly appropriated.

Jordyn
  • 1,133
  • 2
  • 13
  • 28
  • http://stackoverflow.com/q/8674831/1415724 --- `{$number++}` and answers in that post, also http://stackoverflow.com/q/4600175/1415724 maybe. – Funk Forty Niner May 02 '17 at 18:28
  • Possible duplicate of [How do you increment an assigned variable in smarty without displaying it](http://stackoverflow.com/questions/8674831/how-do-you-increment-an-assigned-variable-in-smarty-without-displaying-it) – halfpastfour.am May 02 '17 at 22:02

1 Answers1

1

I have no experience with Smarty but this looks like something you are looking for

http://www.smarty.net/docs/en/language.modifier.string.format.tpl

creativename
  • 304
  • 2
  • 16