Answer to the question
The operator is modulo % and also has an alternation mod .
More about recognized qualifiers in smarty reffer for documents: http://www.smarty.net/docsv2/en/language.function.if
Answer your problem
So, as you now know, your modulo statement is correct.
From what I can guess from your syntax, you are probably trying to access the value of the array by the index of the array.
To access the elements of the array you have 2 options:
- Array Access - Syntax:
$arrayVariable.key - Access by array index - syntax:
$arrayVariable[index] (index - int number)
So, in your case: $que_seq_no[$sub_ques_no+1]
If you are trying to access an object:
it looks like access by array key, but the operator -> , so the syntax is: $objectVariable->propertyName
Refer to smart documents for more on this: http://www.smarty.net/docsv2/en/language.variables.tpl
Which probably confused you
I think you are a bit confused about using {} (braces)
- they are used to wrap the expression of the whole smarty, so it follows from it that they cannot contain any other { or } .
Nice example taken from smarty docs:
{if $name == 'Fred' || $name == 'Wilma'} ... {/if}
source share