cloudy cloudy

Author Topic: Having weather data appear on your homepage using XML  (Read 12507 times)

0 Members and 1 Guest are viewing this topic.

Offline Weather Display

  • Posts: 85,294
  • Davis VP2
  • New Zealand
    • Weather Display
Having weather data appear on your homepage using XML
« on: November 14, 2003, 12:09:20 AM »
This is a good way to reduce upload traffic or to display data from multiple stations
To use, tick the option in the custom web page setup (setup, ftp/internet setup)
Weather display will create, if not already created a template called wdfulldata.htm ,at the custom web page update times, or you can set times to update and upload the wxlocal.html file (even if you dont have it in use) in the customise internet and file creation setup

you can alter that afterwards
then from that wdfulldata.xml is created and uploaded
then to use the data in the xml page (and any number of pages can use this one page, or you can even use pages from other web sites )
to add (example) to your custom web pages (and you can even add to the default wd datahtm0.txt etc if you tick that option)
note: to use data from other peoples sites:
Adjust your browser settings. In IE, go to Tools > Internet Options > Security Tab. Select Internet, then select Custom Level. Select Access Data Sources Across Domains from the Miscellaneous

Add the following code to somewhere near the start of your html code, i,.e after the BODY command

<XML ID="dsoCityST" SRC="http://www.yoursite.com/wdfulldata.xml"></XML>

<XML ID="dsoCityST2" SRC="http://www.yoursite2.com/wdfulldata.xml"></XML>

Each ID must be different according to the city and state you are grabbing data from; i.e., dsoOmahaNE

3) Now create a table. Tables are needed for this to work. The table tag should look like this:

<TABLE DATASRC="#dsoCityST">

You can add anything into this table tag, but the DATASRC="#dsoCityST" must be in there.

4) Grab the data! Where you want the temperature to be, you simply add <span datafld="TEMP"></span> and that's IT! This will go where you would normally add your WD tags. Of course, you will still need to add your mph and " text after that as you normally would using a WD template.

5) Tables cannot share data. Each City/State must have its own table to work. There is no closing tag for the XML. Your normal </tr> will work for this.


example:
<TABLE DATASRC="#dsoCityST"><SPAN DATASRC="#dsoCityST" DATAFLD="temp"></SPAN>C  (<SPAN DATASRC="#dsoCityST" DATAFLD="tempinusa"></SPAN>F) <SPAN DATASRC="#dsoCityST" DATAFLD="gstspd"></SPAN>kts  <SPAN DATASRC="#dsoCityST" DATAFLD="dirlabel"></SPAN> at time/date:<SPAN DATASRC="#dsoCityST" DATAFLD="time"></SPAN>/ <SPAN DATASRC="#dsoCityST" DATAFLD="date"></SPAN>
 </TABLE>