Domanda

I am Having Trouble with Smarty. I need to do some calculations, Assignments, and Deletions in the .tpl file i.e. smarty. But the problem I am facing is that when ever I do {$idlist[$iSum+1]} It gives Error. here $idlist is an array and $iSum is a an Integer. It works fine with {$idlist[$iSum]} or {$idlist[3]} but gives error in {$idlist[$iSum+1]}
What must be the syntax to run some statement like this {$idlist[$iSum+1]} ?

È stato utile?

Soluzione

Try it this way

{assign var="iSum" value=$iSum+1}

since you also want to use mathematical operation template side, Also read smarty math function

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top