Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
vB Weather Mk. 2 Details »»
vB Weather Mk. 2
Version: 1.00, by JJR512 JJR512 is offline
Developer Last Online: Jun 2006 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 08-02-2002 Last Update: Never Installs: 59
 
No support by the author.

This is a post of a much-revised hack originally posted (by myself) here. I am posting this as a new hack because MSNBC, who the raw weather data is provided through, has changed their source provider (from AccuWeather to The Weather Channel), which required a retooling of the data parsing code, as well as completely new databases. I have also made obsolete the weather_functions.php file, moving the functions to admin/functions.php, simplifying the ability to show current weather data on any page (if desired). Finally, in what I'm sure will be welcome news to many people who have installed the original, I've completely rewritten the instructions, making them, as far as I can tell, much simpler.

If you are unfamiliar with the original: This hack provides current weather conditions and a five-day forecast to your members. Each member can select from over 34,000 cities, by narrowing down from region (like continents), country, and subdivision (like states). Each member can also select to see temperatures in Fahrenheit or Celsius, as well as metric or standard measurements for the other data.

A demo is available on my test board: http://www.jjr512.com/testboard/. I have set up an account for anyone to use to test it out (username: test; pw: test). If you are not logged in, you will see default weather on the home page (default is set to New York City), and cannot change settings (I forget if you can view a detailed forecast, though; you may be able to). If you do log in, you can change the settings for the test account, to see how it works.

***
If you have installed any previous version, you should completely uninstall it. Read the instructions and work backwards from there: Delete all templates added, remove changes to any existing templates (I forget if there were any or not), delete all new tables from the database, delete all new files added by the old hack. All have been changed to some extent, some more than others, and it would be easier to work from a clean slate. Especially since some of the template names have changes, so if you don't delete the old ones, they'll just be sitting there doing nothing at all. It is also vitally important to delete (or "drop") the tables--I believe there were six--you added for the original version. The new ones have different data and, for some, a different structure, so do not just empty them. Remove them totally.

Good luck!

Change Log
v1.1a: Current Version: Corrects a small error where an incorrect variable was used in the code to show the local time of the last update. If you already have v1.1, you only need to do the fix described in Post #82 below.
v1.1: Changes display of last update time to be the correct time in the user's own local time zone; previously, it was always Eastern Time (GMT-5) (Upgrade instructions are in Post #79 below). Also breaks the weather_city.sql into six smaller pieces (useful only to new installations; existing installations need not worry about this).
v1.0a: Adds instructions on how to add location to current weather on forums home page (changes to code added to index.php and forumhome_weather template).
v1.0: Original Release

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #62  
Old 08-05-2002, 09:26 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I guess you didn't do Steps 2 and/or 3 in the instructions.
Reply With Quote
  #63  
Old 08-05-2002, 09:32 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by chris2707
This is brilliant and I got it working straight away!

One question, I notice that if I choose London, United Kingdom, the time of last update is showing the USA timezone rather than the boards timezone setting. Is the update value being picked up directly from MSN? Can it be changed so it matches the boards selected timezone?

Many thanks for a great addition (and you know what the English are like for weather!)

Chris
Yes, I know what English weather is like: When I was researching the new raw data layout for this hack, I had to find what a bunch of different forecasted-weather-type codes meant (how a code number in the raw data translated to meaningful text, which is what you see in the forecast under the icons). I did this by randomly checking weather forecasts for various cities on the MSNBC weather page, then looking at the raw data for the same city to see what code was associated with what description. Well, I solved a lot of that by looking up cities in England, which is where I got most of the rain-related codes, LOL! "AM Showers", "AM Light Rain", "Light Rain/ Wind", haha...about a dozen variations of what we in the US just call "rain"!

As for your actual question...The time comes straight from MSNBC; it's part of the raw data. I'll see if there's a way I can make it localized.
Reply With Quote
  #64  
Old 08-05-2002, 09:36 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The raw data has this bit in it:

08/05/2002 18:00:00

As you can see, I just echo that in the display. I don't even know what time zone it is, so I'm wondering how you can tell?
Reply With Quote
  #65  
Old 08-06-2002, 06:35 AM
chris2707 chris2707 is offline
 
Join Date: Feb 2002
Location: West Yorkshire, UK
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On MSNBC is says ET somewhere near the time so I guess that's Eastern Time (shouldn't that be EST?).

Anyway, I guess there must be a way to convert the text back to time format and re-format it. I'll have a go and see if I can get it working.

Thanks again,
Chris
Reply With Quote
  #66  
Old 08-06-2002, 04:12 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It probably says ET so it's correct if it's EDT or EST. Yeah, there's a way to convert it into a workable time format; I looked into it once, but never did anything with it.
Reply With Quote
  #67  
Old 08-06-2002, 04:17 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a way to have the Last Update Time set to the timezone and time/date format of our sites?

Quote:
Originally posted by JJR512
It probably says ET so it's correct if it's EDT or EST. Yeah, there's a way to convert it into a workable time format; I looked into it once, but never did anything with it.
Reply With Quote
  #68  
Old 08-06-2002, 04:20 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You have read Post #s 60 and 63-66, right?
Reply With Quote
  #69  
Old 08-06-2002, 04:22 PM
reifegerste reifegerste is offline
 
Join Date: Jul 2002
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

When i click to Detailed Forecast or Change Settings i see the following error code:

Fatal error: Cannot redeclare convert_temp() in /home/username/www.forum.de/vbulletin/weather_functions.php on line 4

what can i do?

greetz
Lars
Reply With Quote
  #70  
Old 08-06-2002, 04:31 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, I read all of that. What I meant was, is there a way you can parse the time after you collect the raw data (instead of just echoing it) to match that of the site so everything stays in a site standard format.

Quote:
Originally posted by JJR512
You have read Post #s 60 and 63-66, right?
Reply With Quote
  #71  
Old 08-06-2002, 04:32 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you upload the new weather.php? It sounds like you are still using the old one. Get the new one out of the ZIP file and upload it to your forums directory. Also, in your forums directory, delete the file named weather_functions.php, which is not used anymore.
Reply With Quote
  #72  
Old 08-06-2002, 04:40 PM
reifegerste reifegerste is offline
 
Join Date: Jul 2002
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where can i find the new weather.php?

in weather_mk2_v1[1].0.zip i can't see the weather.php

aranoid:
Reply With Quote
  #73  
Old 08-06-2002, 04:43 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

reifegerste, you need to download the ZIP file currently attached to the original message in this thread. It's weather_mk2_v1.0a.zip.

Boofo, what you are asking for is exactly what we've been discussing in those posts.
Reply With Quote
  #74  
Old 08-06-2002, 04:54 PM
reifegerste reifegerste is offline
 
Join Date: Jul 2002
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi,

i do it https://vborg.vbsupport.ru/attachmen...&postid=280268

weather_mk2_v1.0a.zip

but when i extract this file i can't see the weather.php

only the templates (4), instruction und readme files
an two zip files (icons and data)
Reply With Quote
  #75  
Old 08-06-2002, 04:55 PM
reifegerste reifegerste is offline
 
Join Date: Jul 2002
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh sorry


my cache was incorrect

this hack is great!!!
Reply With Quote
  #76  
Old 08-06-2002, 05:15 PM
chris2707 chris2707 is offline
 
Join Date: Feb 2002
Location: West Yorkshire, UK
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The problem with that Boofo is that the time the raw data is collected is not when the data was updated - in other words, could be 2 hours old when it is collected from the MSNBC server by vbWeather.

If you go to the MSNBC server mentioned near the beginning of this site you'll see no matter what country/city you select, the time remains constantly on the ET timezone - in my humble opinion it should change to whichever city you select since, even if you are going on holiday and checking the weather, it's still nice to know what time it is there!

I'm fairly new to PHP coding but I will have a look at converting the time string retrieved back to a time format for correct display.

Chris.

Quote:
Originally posted by Boofo
Yes, I read all of that. What I meant was, is there a way you can parse the time after you collect the raw data (instead of just echoing it) to match that of the site so everything stays in a site standard format.

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:08 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06653 seconds
  • Memory Usage 2,366KB
  • Queries Executed 30 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (16)post_thanks_box
  • (16)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (16)post_thanks_postbit_info
  • (15)postbit
  • (16)postbit_onlinestatus
  • (16)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete