New - WD PHP Tags System. Over 2000 bits of weather data.

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.

Wow, a lot of work there.

“The raw tags file contains every single Weather Display custom tag.”

Does this mean that WD is generating every possible tag every time? What is your experience of the CPU load resulting from doing that?

Yeah…what he said ^^^^^^^^^^^^^^^

Hi niko, I’ve been using this system for some time, and prior to that I was using the old system that used the same raw tags file, reliably, since about mid summer generating the file and uploading it every 5 mins. I haven’t had any problems with CPU load on my P4 3.41 system at all. Certainly not that efects anything else running on the computer in all that time, and I am running other stuff on it too. I think even on a less powerful system, it may take a bit longer to generate the file, but it shouldn’t overload the system.

How often do you generate the file?

There’s a whole wagon load of tags that I would never use…can they be deleted without creating problems?

I’ve had it generating and uploading every 5 mins 24/7 since about the end of July or so. So it’s well tried, and tested! Others have been using it with the old system too and I’ve had no reports of computers going sluggish. The file comes out at about 50kb so it can take a couple of seconds to upload. However, the script has a failsafe built in just in case a visitor opens a page at the same moment that the tag file is being uploaded. In a nut Shell, it just reloads the page, by which time the upload is complete. So the visitor never sees any missing data or nasty error messages.

There’s a whole load that I never use as well :slight_smile: but they are there for anyone who does use them. The problem with deleting tags from the file, is that it will no longer be compatible, and the ID numbers would no longer match those in the reference page. You could build your own reference page, but it would be very monotonous and time consuming (trust me on that!), which is why the only reference page is the one on my site!

I can’t really see the point in removing unused tags unless your system is very old, lacking in power and just can’t cope, or unless you have a very stingy web host who only gives you a tiny quota of ftp transfer per month or something. Also remember that only the tags that are relevant to your setup will be generated. If you look at the tags reference page, you will see that lots of my tags remain ungenerated, such as lightning, mesomaps, solar etc. Although they are still there, they don’t get processed. Also, you may be grateful for those unused tags one day if you expand your station and start using them!

If my math isn’t wrong that’s almost 500 gigs a month upload - and you just know that some users will want it to update faster than 5 minutes. I think that there will be many users who don’t have the CPU power (or choose not to use that much power) or bandwidth to support this. To me the whole philosophy of the tag/php system is that it’s low impact. It’s good solid work, and I’m sorry to be negative, but I can think of better ways to do this which I’ll be happy to discuss with you offline rather than continue posting in your thread.

Sorry to correct you, but it’s 5Gbytes a year. Still quite a lot. I’m sure a lot of the end ones could be taken out (like mesomaps) as I would be suprised if they would break the arrays used?

I tell you what would be good (as someone who finds the tag list bewildering) is a webpage where you could select individual tags/groups of tags for inclusion in the tags file. Now that would be useful and streamlined to meet most peoples requirements

Ian

I think your maths is wrong :slight_smile: It’s no where near that much! Some WD graphics are bigger than that, and some people have loads of them being uploaded to their site frequently. 5 mins is the schedule I use for generating and uploading my tags file, but this can be set to any schedule you like in WD. The raw tags file is not new. It’s been available from my site for months, and has been in use by others for as long. All that’s changed is the php that puts the tags on your pages!

Good stuff 35mm

Also remember that only the tags that are relevant to your setup will be generated. If you look at the tags reference page, you will see that lots of my tags remain ungenerated, such as lightning, mesomaps, solar etc. Although they are still there, they don't get processed
good point that too :)

Whoopsie, you’re right, almost 500 megabytes per month :oops:

If 500Mb per month gets you worried, you should change your host! :lol: Here’s a little tip that a lot of people don’t know. I do web hosting so I know this. The monthly data transfer that your web host gives you, rarely includes FTP transfer, as that is harder to monitor than http transfer. However, a few hosts do count ftp transfer, so use one that doesn’t. Also I didn’t just tell you you that!

Thanks Brian. I should also add, this system does very little unless you use it with Weather Display! :slight_smile: How long did it take to come up with all those tags? It took me 4 days to copy and past them!

Ian, you could remove tags from the end of the file so long as you don’t break the order. However, as has already been covered in this thread, there is no point, as the file isn’t that big, and doesn’t use too much CPU. If you try it out, you’ll see.

I’m impressed 8O…that is a whole heap of work that you have done there…and I really like the idea. 8)

As a novice web page maker though, I’m still trying to get my head around this to put the volumes upload size into perspective. Given that the overall file size being talked about (the entire 2000 tags) is some 50 kb and by comparison a videolasthour (jpg) is some 180 kb …or a WD banner (mine) is 48kb(every 15 mins)…then there would indeed appear to be merit in doing the upload of the tags at reasonable intervals…upwards of say, every 5 or10 mins without too much detriment to the overall upload totals per month etc…I’m sure that this might even be a better case to argue if one simply cut back on some other upload intervals and balanced one with the other, particularly if you use webcam images a lot as I do…mmm

Well done 35mm, you have given us a another tool in the armoury. Now to have a long think and actually have a go at using it. :wink:

It seems that most have WD Live running on their sites, which updates about once per minute (or at least mine does). So for the rest of the data on your site, 5 minute updates would be the most regular interval that would be necessary. I mean the whole site doesn’t have to be live. You are right though, the tags file isn’t what will consume your monthly data transfer (often wrongly referred to as “bandwidth”). It’s your visitors viewing all those graphics, photos and videos that will do that! The thing is though, in recent years the cost of data transfer has been coming down rapidly, and you can now get a web hosting account that has more space than you can use, and more monthly transfer than you can use, for just a couple of dollars!

Don’t be put off by someone knocking this system before they have even tried it! Try it for your self. If you have any difficulties using it, let me know and I’ll be happy to help you get it working.

I find this system intriguing - thank you for all your work on it! My site is based on the older AJAX Carter Lake templates but I have customized it here and there. I currently upload a lot of WD generated HTML files only because I one one or two stats on pages that use the regular WD tags. I like your system because I can then whittle that down to your one tag file. I am very slowly working on a total site redesign and definitely will look to implement this. Thanks!

Tony

I’ve tried about a dozen times now to upload the file to website and it crashes WD everytime.