Author Topic: Adding a new UOM  (Read 2462 times)

0 Members and 1 Guest are viewing this topic.

Offline floodcaster

  • Forecaster
  • *****
  • Posts: 635
    • Goose Lake Weather
Adding a new UOM
« on: January 20, 2009, 09:02:44 PM »
I wanted to add a new UOM of centibars for soil moisture on a page I'm creating in my ajax/php site. I tried adding $SITE['uomSoilMoist'] = ' cb'; in the Settings.php and then referencing that in my page but no luck. Is there a step I'm missing?
Bill


Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com
Re: Adding a new UOM
« Reply #1 on: January 20, 2009, 09:18:57 PM »

Are you using VWS or WD?

Kevin...
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Adding a new UOM
« Reply #2 on: January 20, 2009, 10:30:22 PM »
If you're using the WD/AJAX/PHP template set, and you created a page using the wxnewpage.php as the starting point, then you should be able to <?php echo $SITE['uomSoilMoist']; ?> to print it on the page.

If you're not using the template set (or hadn't created a new page from the wxnewpage.php), then you may have to
include
Code: [Select]
<?php include_once("Settings.php");
global 
$SITE;
?>
near the top of the page, then use the above to print the value.

It would be helpful to have a URL to the page you're modifying :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline floodcaster

  • Forecaster
  • *****
  • Posts: 635
    • Goose Lake Weather
Re: Adding a new UOM
« Reply #3 on: January 21, 2009, 05:40:54 PM »
Hi Ken,
Yes, using the WD ajax/php files and I've used the wxnewpage.php template.

Sorry, still new to PHP but this is a great learning experience!

I got it to work with:
<?php echo strip_units($fourinchsoilmoist) . $SITE['uomSoilMoist']; ?> </td>

Why wouldn't it work with:
<?php echo strip_units($fourinchsoilmoist) . $uomSoilMoist; ?> </td>

if in the page you have the code:
require_once("Settings.php");

I didn't include the URL as I just slapped together a table to see if my new additions to the testtags would work but it's here if you want to see it. Still messing with it and have a ways to go. ;)

Bill
Bill


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Adding a new UOM
« Reply #4 on: January 21, 2009, 07:19:19 PM »
I got it to work with:
<?php echo strip_units($fourinchsoilmoist) . $SITE['uomSoilMoist']; ?> </td>

Why wouldn't it work with:
<?php echo strip_units($fourinchsoilmoist) . $uomSoilMoist; ?> </td>

if in the page you have the code:
require_once("Settings.php");


Just putting it in the Settings.php file only ensures that $SITE['uomSoilMoist'] has content.  If you want to name a local variable as $uomSoilMoist   (like I have done with $uomTemp, $uomBaro ... etc in ajax-dashboard.php), then you'll need to include code like
Code: [Select]
if (isset($SITE['uomSoilMoist'])) {$uomSoilMoist = $SITE['uomSoilMoist'];} .. see the samples at the start of the ajax-dashboard.php.

Then (with the above code) you could use
<?php echo strip_units($fourinchsoilmoist) . $uomSoilMoist; ?> </td>

in your page.

Hope this helps...
Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline floodcaster

  • Forecaster
  • *****
  • Posts: 635
    • Goose Lake Weather
Re: Adding a new UOM
« Reply #5 on: January 21, 2009, 07:27:50 PM »
Ahhh...I see what you mean. Thanks for the explanation Ken (and your patience) . :-)
Bill


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Adding a new UOM
« Reply #6 on: January 22, 2009, 01:54:31 AM »
You're very welcome!  Glad I could assist. :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything