cloudy cloudy

Author Topic: New - WD PHP Tags System. Over 2000 bits of weather data.  (Read 15764 times)

0 Members and 1 Guest are viewing this topic.

Offline 35mm

  • Posts: 225
  • Plymouth, England
    • Newton Ferrers & Noss Mayo
New - WD PHP Tags System. Over 2000 bits of weather data.
« on: November 05, 2008, 03:29:56 PM »
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;
Code: [Select]
<?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.
Code: [Select]
<?php tags(636,uc); ?> will display "3.3 KTS".

Remove text from data to leave just numbers. (,strip)
e.g.
Code: [Select]
<?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.
Code: [Select]
<?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;

Code: [Select]
<?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.

"You don't need a weatherman to know which way the wind blows."
- Bob Dylan

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 28,170
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #1 on: November 05, 2008, 03:39:38 PM »
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?

Offline lulu836

  • Linda
  • Posts: 2,242
  • Louisiana
    • Luv Retirement
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #2 on: November 05, 2008, 03:52:07 PM »
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 ^^^^^^^^^^^^^^^

Offline 35mm

  • Posts: 225
  • Plymouth, England
    • Newton Ferrers & Noss Mayo
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #3 on: November 05, 2008, 03:54:26 PM »
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?

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.

"You don't need a weatherman to know which way the wind blows."
- Bob Dylan

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 28,170
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #4 on: November 05, 2008, 03:55:38 PM »
How often do you generate the file?

Offline lulu836

  • Linda
  • Posts: 2,242
  • Louisiana
    • Luv Retirement
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #5 on: November 05, 2008, 04:03:36 PM »
There's a whole wagon load of tags that I would never use........can they be deleted without creating problems?

Offline 35mm

  • Posts: 225
  • Plymouth, England
    • Newton Ferrers & Noss Mayo
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #6 on: November 05, 2008, 04:06:11 PM »
How often do you generate the file?
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.

"You don't need a weatherman to know which way the wind blows."
- Bob Dylan

Offline 35mm

  • Posts: 225
  • Plymouth, England
    • Newton Ferrers & Noss Mayo
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #7 on: November 05, 2008, 04:15:35 PM »
There's a whole wagon load of tags that I would never use........can they be deleted without creating problems?
There's a whole load that I never use as well :) 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!
« Last Edit: November 05, 2008, 04:19:23 PM by 35mm »

"You don't need a weatherman to know which way the wind blows."
- Bob Dylan

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 28,170
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #8 on: November 05, 2008, 04:26:40 PM »
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.

Offline landingz

  • Posts: 12
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #9 on: November 05, 2008, 04:33:54 PM »
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
« Last Edit: November 05, 2008, 04:38:22 PM by landingz »

Offline 35mm

  • Posts: 225
  • Plymouth, England
    • Newton Ferrers & Noss Mayo
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #10 on: November 05, 2008, 05:47:52 PM »
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.
I think your maths is wrong  :) 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!

"You don't need a weatherman to know which way the wind blows."
- Bob Dylan

Offline Weather Display

  • Posts: 87,192
  • Davis VP2
  • New Zealand
    • Weather Display
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #11 on: November 05, 2008, 05:50:59 PM »
Good stuff 35mm
Quote
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 :)

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 28,170
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #12 on: November 05, 2008, 06:15:02 PM »
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?

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

Offline 35mm

  • Posts: 225
  • Plymouth, England
    • Newton Ferrers & Noss Mayo
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #13 on: November 05, 2008, 08:26:40 PM »
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!
« Last Edit: November 05, 2008, 08:45:16 PM by 35mm »

"You don't need a weatherman to know which way the wind blows."
- Bob Dylan

Offline 35mm

  • Posts: 225
  • Plymouth, England
    • Newton Ferrers & Noss Mayo
Re: New - WD PHP Tags System. Over 2000 bits of weather data.
« Reply #14 on: November 05, 2008, 08:33:55 PM »
Good stuff 35mmgood point that too :)
Thanks Brian. I should also add, this system does very little unless you use it with Weather Display! :)  How long did it take to come up with all those tags? It took me 4 days to copy and past them!

"You don't need a weatherman to know which way the wind blows."
- Bob Dylan