Gossamer Forum
Quote Reply
Calculations
How to divide 2 variables and display it as a third? I tried several versions but with no result ... CrazyMad

Thanks in advance.
Quote Reply
Re: [katakombe] Calculations In reply to
Hi,

A global could do this (you could probably also do it in a template tag, but can't remember off hand =))

Code:
do_divide
sub {
return $_[0] / $_[1];
}


<%do_divide($variable1,$variable2)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Calculations In reply to
Brilliant as always .. CoolSmile

Thank you Andy!
Quote Reply
Re: [katakombe] Calculations In reply to
You can just do <%var1 / $var2%>

Adrian
Quote Reply
Re: [brewt] Calculations In reply to
Thank you Brewt!

In fact, the complete scenario looks like:

Code:
A * A * 12 / 365 / B

Anyway, Andy's solution work fine Smile