Please move this to the FAQ forum if deemed useful: This is my first FAQ - Suggestions or mistake corrections welcome!
Using Server Side Includes for Weather Station Data
Note: This process does require some understanding of web page and web site creation. If you have little to no experience creating web sites I would not recommend trying this unless you wish spend a lot of time figuring it out. But once you do figure it out it will be rewarded with much easier web site maintenance.
One item I found to be a pain is that if I wanted to change something like a menu on my weather station web site pages it had to be changed on every page and then those pages would have to placed in WD’s webfiles folder so they are properly processed before each upload. Since I do my web site work on another computer this meant that I would first have to copy the files to a thumb drive then take that thumb drive to the weather station computer to transfer them to WD for processing. Not that hard to do, just a pain.
I decided to use SSI or Server Side Includes to process the weather station data to be included in my web page template. Server Side Includes allows you to place the contents of file into your web page in real time as the page is displayed by your browser. What this does is allow you to make a file that only contains the html for the menu and place it on your page where you want. If the menu ever needs to be changed, you just change that one file, upload it to your server and that menu will be changed on every page that uses that menu.
Note: As far as I know, SSI is only usable on Apache type servers (unless someone lets me know you can do it on other servers), so those running Windows servers can not use this process unless you are running Apache.
Note 2: These instructions assume you are using Custom web pages in WD and not the standard web page uploaded by WD.
If you also use SSI for the information that WD uploads to your site you will also decrease the amount of data that WD has to transfer. This will reduce the load on your WD computer since the files it has to convert will be smaller, the transfer times will be shorter and less bandwidth will be used during uploads.
If you look at my Personal Weather Station web site at
http://www.hobbytalk.com/weather/ it looks like a normal web page. But almost every data element of each page uses SSI. From the menus, to the Current Warnings and even the actual weather data is inserted in a template using SSI.
Setting Up Your Web Site Server
The first thing you will need to do is setup your web server and pages so SSI can parse the information. The easiest way to do this is to just name your web pages with the .shtml extension. Some may not want to do this for a number of reasons. If you don’t want to rename your web pages you can use a .htaccess file to do that same thing.
Just create a file in Notepad and put the following line in it:
AddHandler server-parsed .html
Save the file and name is anything you want. Transfer the file to the root of your weather web site and then rename it .htaccess
Note: The file is .htaccess Notice the “dot” before the file name.
There is one shortcoming of doing it this way. It means that every page on the web site will be parsed by the web server looking for SSI code (even if it doesn’t have any SSI code) when that page is displayed. In rare cases this can cause web server performance problems for large and busy sites. In my case every page in my weather site uses SSI so using this method is not a problem.
Creating a Menu Using SSI
The first thing you will want to do is modify your current web page to use SSI. Let’s start with the main page (wxlocal.html). I would suggest that you only do one page at first to make sure it is working for you and that you have the hang of it. Once one is done you can then move on to doing the others.
Locate in the html code of this page where the menu is displayed. Take that menu code and remove it… but wait!!!! Don’t throw that code away!!!! Cut (highlight and press Ctrl-X) that code out and then Paste (press Ctrl-V) it into Notepad and save that file as menu.html.
In place of the code you cut out of wxlocal.html insert the following:
<!--#include virtual="menu.html" -->
Save the wxlocal.html file placing it in WD’s webfiles folder. Now take the menu.html you just created and upload it to your web server into the same folder as where your weather web files are.
Note: The menu.html should NOT contain anything other then the html code needed to create the menu. That means there should not be any <html> <head> <title> tags or any other such tags in that page. SSI will take all of the code in that page and place it in the viewed page. If you have <html> <head> <title> tags in the menu.html page this will cause these tags to be on your web site twice and it can/will break the display of that page.
Now, the next time that WD uploads the modified wxlocal.html file your new menu should be placed in the same exact spot as before. Once this is done to each of your wxlocal files all you will ever need to change is the menu.html file when you want to make a change to your menu.
Let’s Get Fancy
Once you are comfortable with this process you can then move on to doing much more. I use SSI to insert the weather data itself into my pages. Using the same process above I have created a common template that only includes the html “wrapper” that data is inserted into.
In the case of wxlocal.html I stripped out the area where weather data is inserted and placed the following:
<!--#include virtual="wx.html" -->
This file is now named index.html and is placed on the server. My wxlocal.html file in WD’s webfiles directory only contains only the code needed for the data of the page and is parsed and uploaded by WD as wx.html
As you can see, WD now only has to parse a much smaller page and will do so more quickly with the uploads to your web site also being smaller.
Enjoy!