Blog
Developers
Careers
Support
Contact
Gossamer Threads
Solutions
Results
About
Mailing Lists
Resource Centre
Forum
Tools
Home
Who's Online
Tags
Favourites
Login
Forum Search
(
Advanced Search
)
This forum
This category
All forums
for
Home
:
Products
:
Gossamer Links
:
Development, Plugins and Globals
:
Calculations
Previous Thread
Next Thread
Print Thread
View Threaded
Dec 3, 2009, 9:44 AM
katakombe
User
(208 posts)
Dec 3, 2009, 9:44 AM
Post #1 of 5
Views: 4743
Shortcut
Calculations
How to divide 2 variables and display it as a third? I tried several versions but with no result ...
Thanks in advance.
Dec 3, 2009, 11:30 AM
Andy
Veteran
/ Moderator
(18436 posts)
Dec 3, 2009, 11:30 AM
Post #2 of 5
Views: 4672
Shortcut
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
Want to give me something back for my help? Please see my
Amazon Wish List
GLinks ULTRA Package
|
GLinks ULTRA Package PRO
Links SQL Plugins
|
Website Design and SEO
|
UltraNerds
|
ULTRAGLobals Plugin
|
Pre-Made Template Sets
|
FREE GLinks Plugins!
Dec 4, 2009, 7:20 AM
katakombe
User
(208 posts)
Dec 4, 2009, 7:20 AM
Post #3 of 5
Views: 4595
Shortcut
Re: [Andy] Calculations
In reply to
Brilliant as always ..
Thank you Andy!
Dec 4, 2009, 4:30 PM
brewt
Staff
(4101 posts)
Dec 4, 2009, 4:30 PM
Post #4 of 5
Views: 4573
Shortcut
Re: [katakombe] Calculations
In reply to
You can just do <%var1 / $var2%>
Adrian
Dec 4, 2009, 8:38 PM
katakombe
User
(208 posts)
Dec 4, 2009, 8:38 PM
Post #5 of 5
Views: 4563
Shortcut
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
Previous Thread
Next Thread
Print Thread
View Threaded