For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > July 2004 > Testing for counter value









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Testing for counter value
Sarah Gray

2004-07-13, 4:01 pm

Hi --

I feel like this is elementary but I'm a little stuck. Sorry
if this is obvious -- it's not to me, right now ;)

What's the syntax for testing if {counter}is at a certain value?

I started a counter in a foreach loop and it increments and is reset
periodically
and I want to be able to say
{if counter == 2}
// do something
{/if}

Anyway, nothing happens, it's like the if statement isn't seen.
[also tried {if $counter==2} and {if {counter} == 2}]

Is this possible?

Thanks,s.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com