Hi all,
I have developed a new system to replace the old php tags system that was available from my site. The new system comes as a complete package, is simple to setup and use with only 2 settings that need to be made to the script, and it has options built in to the tags so that they can now be used for just about anything.
What WD PHP Tags does is to enable your web site to work directly with more than 2000 WD custom tags which now become dynamic. This enables you to put any piece of weather information, anywhere on your web site, at any time, and lay it out exactly as you wish, or process it further using your own php code (Some examples are included as tutorials in the package). It’s a very simple system so it’s ideal for php novices, yet it can be used to do just about anything the php pro wants.
The new system can be used by anyone, but it’s particularly useful if you enjoy the web design process of building your web site, and want to make your site completely unique instead of using WD’s static html pages, or a cloned template system. WD PHP Tags has been designed so that the setup code to make your pages work with the system will work in Dreamwaver template (.dwt) files, and should work in any other types of template too, as well as in ordinary individual php pages.
The new WD PHP tags system still uses the raw tags file (included) which you give to Weather Display to generate and upload to your site every 5 minutes or so, and uses the same ID numbering system, which used in conjunction with the tags reference page, makes it easy to find the exact bit of weather info you want to show on your page out of the 2000 odd available choices.
Appart from that, this system is completely different to the old one. It uses different tags, although it does use the same ID numbers, so if you want to convert from the old version to the new version, it’s quite straight forward. You can put simple options into the tags to change the case of text in 3 different ways, remove text from numbers, and return the data so that it can be processed further by php if you want.
Here is what a basic tag now looks like;
<?php tags(636); ?>
The above tag, when placed into your WD PHP Tags enabled page, will display the current average wind speed e.g. “3.3 kts”. The number 636 is the corresponding ID number for the “current average wind speed”, as can be found via the Tags Reference Page.
There are various options that we can add to the tag to do different things. They are;
Change the case of text. We can have the first letter of each word “Upper Case”, the first letter of just the first word “Upper case”, or all letters of all words “UPPER CASE”. (,cap ,cap1 ,uc)
e.g.
<?php tags(636,uc); ?>
will display “3.3 KTS”.
Remove text from data to leave just numbers. (,strip)
e.g.
<?php tags(636,strip); ?>
will display “3.3”.
Return the data instead of echoing it so that we can process it using our own php code.
e.g.
<?php tags(636,no,ret); ?>
will display “” (nothing!). The data is not being printed to your page, but is now available as raw data that can be passed to other scripts. The return option always comes after the text option, so we have to specify the text option as “,no” which just means no text options. Of course, we couls also put a text option in there too, such as strip, so that we can work with just the numbers in our script. e.g. (636,strip,ret).
Let’s have a look at what we could do by using, and combining some of these options in a simple script of our own. In HTML pages generated by Weather Display, they show both heat index and wind chill. That doesn’t make any sense as you can only have one or the other, but not both at the same time! Using our WD PHP Tags enabled web pages we can now fix this by putting the following simple code into our page;
<?php
if (tags(379,no,ret) == tags(368,no,ret))
{
echo "";
} else if (tags(361,no,ret) == tags(379,no,ret))
{
echo "heat index: ";
tags(368);
} else if (tags(361,no,ret) == tags(368,no,ret))
{
echo "wind chill: ";
tags(379);
}
?>
The above script is taken from one of the tutorials included in the package. It will switch between displaying heat index or wind chill depending on which one is relevent at that time.
The data from each tag is displayed in your web page in the position where you put the tag. So you can include any WD data within a block of text, a table cell, within a javascript, in a php script, or where ever you want. You can use an unlimited number of tags on a single page. The WD PHP Tags system makes it very easy to add additional weather data to your web site at any time, and build advanced weather history pages etc, directly on your web site, with out having to make any changes within Weather Display.
The raw tags file that is included in the package is completely universal. This means that the ID number for your daily rainfall is the same as everyone else’s who uses this system. So you could for example, create a clever script to process some weather data on your site, and give the script to someone else to use, knowing that it will work just as well with their weather data on their web site.
I will be adding additional features and functions to this script as time goes on. Updating to the latest version and getting additional features will be as easy as changing one line, and overwriting one old script file with the new one.
Please go to my web site for more information and to download the WD PHP Tags package.