Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2009
    Posts
    156
    Thanks
    47
    Thanked 0 Times in 0 Posts

    Unhappy Assistance with multiple {counter}'s in Smarty...

    The only problem with this is that it skips a number (from 1 to 3). Is that fixable?

    {foreach item=item key=key from=$data}
    {counter var="$label+1" assign="label"}
    {counter var="$id+1" assign="id"}

    <label for="checkbox{$label++}"></label><input id="checkbox{$id++}" type="checkbox" name="txtcheck[]" value="{$item.id}" class="crirHiddenJS" /><br />

    ...
    {/foreach}

    * The code in red is what I've added.
    Last edited by Daniellez; 08-07-2009 at 04:29 AM.

  • #2
    Regular Coder
    Join Date
    Jan 2009
    Posts
    156
    Thanks
    47
    Thanked 0 Times in 0 Posts
    Disregard. It's now working with the following:

    {foreach item=item key=key from=$data}
    {math equation="$label+1" assign="label"}
    {math equation="$id+1" assign="id"}

    <label for="checkbox{$label++}"></label><input id="checkbox{$id++}" type="checkbox" name="txtcheck[]" value="{$item.id}" class="crirHiddenJS" /><br />

    ...
    {/foreach}


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •