Calculations

I would like to take some existing tags and make calculations on a page. For example: today’s max minus today’s min giving the difference.

Can anyone lead me in the direction as to where I can learn the code to make simple calcs like this?

Tanks,
MH

Where are you getting your data from? Clientraw, wdtags ??

Do you want to do this in PHP, javascript ?

I would be getting my data from wdtags. Php or Java script, I don’t know which would be best or which would be easiest. I am looking of guidance

Piece of cake in php http://www.realweatherstation.com/btest/phpmath.php

<?php $tempmin = -10; $tempmax = 72; $tempdiff = ($tempmax - $tempmin); echo "Max temp = $tempmax, Min temp = $tempmin, Temp range = $tempdiff"; ?>

Use WD %% tags for the tempmin and tempmax to generate this code to be uploaded.

niko
I tried the following test and get a PARSE error message

<?php $tempmin = %mintemp%; $tempmax = %maxtemp%; $tempdiff = ($tempmax - $tempmin); echo "Max temp = $tempmax, Min temp = $tempmin, Temp range = $tempdiff"; ?>

If I use numbers -10 and 72 as you said it works OK.

Do I have to have this file in WD named wxlocal and have WD re-name it to wx.php when it is uploaded via custom upload screen?

Thanks
Frank

Yes, and take a look at what the generated page contains. It was just a very simple example to show how easy calculation is in php.

Niko

Thanks. The generated page contains $tempmin = 52.0

I though there were tags without F or C available? If not then it needs a bit more code to extract the numbers only.

These tags work for doing math. They do not have

I think I need a better understanding of writing html source code before jumping into php. I found a great looking training site http://www.w3schools.com/default.asp. I’ll try this site unless someone can direct me to a better one.

There are hundreds of thousands of sites available on learning HTML. I would not limit yourself to a single site as when you have difficulty understanding something, another site might give an example or explanation that makes more sense.

Use your “Google Support Contract” to find examples and explanations on how to do HTML… you will learn quicker. W3Schools is a good site, but there are many many others.