Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Simple Addition in Template?

Quote Reply
Simple Addition in Template?
I'd like to add three variables together... can I do that in a template or do I have to do it somewhere else? For example I have three variables, Visits1, Visits2, and Visits3. Shouldn't I be able to do this:

<%Visits1 + Visits2 + Visits3%>

I also tried:

<%set Total = 0%>

<Total += Visits1>,

<Total += Visits2>,

<Total += Visits3>

<%Total%>

But neither work... any ideas on how to best do this?
Quote Reply
Re: [LanceWilson2] Simple Addition in Template? In reply to
You can use:

<%set total += $Visits1%>
<%set total += $Visits2%>
<%set total += $Visits3%>
<%total%>

TheStone.

B.
Quote Reply
Re: [TheStone] Simple Addition in Template? In reply to
Bingo... that did it. Thank you once again.

Looks like I just didn't add the $ to the front of the variable. Doh!