PDA

View Full Version : Arithmetic on vB Variables?


weinstoc
12-10-2007, 12:02 PM
Is there any way to treat a vB variable as a number and perform arithmetic on it?

If the forum id is 5 I would like to be able to write (in a template) something like:

$foruminfo[forumid]-2

and have it print out as 3.

Chuck

TigerWare
12-10-2007, 12:56 PM
How about:-

($foruminfo[forumid] - 2);

weinstoc
12-10-2007, 01:02 PM
I did not think that I could put PHP code inside a template (say the footer)?

Opserty
12-10-2007, 02:36 PM
You have to write your PHP code in a plugin first then assign the result to a variable and use that variable in a template.