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: Give your members current weather and forecasts! Details »»
vB Weather: Give your members current weather and forecasts!
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: 02-25-2002 Last Update: Never Installs: 25
 
No support by the author.

After seeing a weather feature at the vbPortal website, and finding out that I couldn't get it for free, I determined to create it for myself, and give it away to everyone for FREE.

So here it is. It's based in part upon the original MyWeather add-on module for PHP-Nuke, which as I understand was also the basis for the add-on module for vbPortal. Anyway, I basically used the part of the PHP-Nuke module that gets the raw data and parses it into a usable format, although I reworked it some and corrected a few bugs. I wrote on my own the rest of the code which handles and displays the data, along with letting the user select his/her location (to localize the weather), number formats (like ?F or C, winds in mph or kmph, etc.), and various other little bits.

I've done as much testing on it as I can on my own, and have had it running on my own production forums for about a day now. Several people have commented that they really love the feature, that it's almost getting to the point where they don't have to go anywhere else on the Internet. I haven't heard of any complaints or problems yet, though, so I'm reasonably certain it's fit for a full release.

You can demo the hack on my message board: JJR512.com. The first part you should look at is the box that appears in the column of boxes on the left side of the home page. This box displays basic current weather info. There are two links in that box, one to see the forecast, and the other to change settings. I forget if you need to be logged in to see the forecast--it may just show you a forecast for the default location, which is Central Park, New York City, NY, USA--but you definitely need to be logged in to change settings. For the purpose of seeing this hack in action, you can login as Test User using the password testuser. Feel free to change the settings and save them, do whatever.

Installing this hack is in some ways easy, in other ways not so easy. There will only be one file modification. However, there are no specific instructions as to which file to edit or how to edit it. If you want the small weather box to show up on your forums home page, you need to edit the associated file (index.php). If you want it to show up somewhere else, then you need to edit whatever file generates the page where you want it. There is a text file in the ZIP that contains all the code, and only the code, that you need to insert into whatever file. If you prefer, you can turn that text file into a .php file (by adding <?php at the beginning and ?> at the end and renaming it to .php) and simply including it in whatever file you need it in.

You will also most likely need to edit the template that makes the weather box. It's formatted to basically make a box as it appears on my site, which is in the middle of some other boxes in a column. If you want to reformat it to appear as a long thing across the top of the page, like the various stuff at the top of the forums home page here at vbulletin.org, that's up to you. You edit the templates to match your own site.

BTW, I would appreciate it if someone better at PHP coding than myself would take a look over this and tell me if I've done everything right or not. I believe the code works and does what I want it to do, but it seems like it might be a little more complex than it needs to or should be. I guess I'm just wondering if there may have been a more efficient way to do some of the things I did. If you have any tips or advice for me, or even want to rewrite the code to show me, I'd really appreciate it.

OK, so without further ado, here's the hack in the attachment. Whatever problems you have, please post them here, and I'll try to help as best I can, but make no guarantees that I can help at all. Please remember that I write my hacks for my own site first and foremost, so they do what I need them to do, not what I think somebody else might want. I choose to release them here in case anybody else can benefit from them, but you may need some part of it to work slightly differently. If I know how to do it I will try to tell you how to do it, but I won't update the hack with every little feature variation that people ask for. In general, I only update my hacks to fix bugs and to add new features that I want or need for my site.

// Change Log]
03b: Includes necessary database change instructions.
03a: Forgot to update 03 ZIP with new templates; fixed.
03: Changed code for new icon system, added code for forecasted weather type (new part of raw data)
02: Adjusted code for new format of weather forecast raw data
01b: Fixed two missing lines from weather_include.txt
01a: Added missing template; updated instructions regarding missing template; fixed $templatesused variable in weather.php; added text file explaining how to add more cities; updated instructions regarding where to get the icons used for this hack
01: Original release

Show Your Support

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

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

I've been looking into this myself. It seems that Accuweather has changed their icon setup. I'm working on getting all the new icons, and this will probably require some slight code modifications.
Reply With Quote
  #83  
Old 07-31-2002, 07:12 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the quick reply.

Is there any way to fix the temperature problem? I think it might be reading 104 or something like that but only show 4 degrees. I guess if you get cold enough, it would seem really hot, huh?

Quote:
Originally posted by JJR512
I've been looking into this myself. It seems that Accuweather has changed their icon setup. I'm working on getting all the new icons, and this will probably require some slight code modifications.
Reply With Quote
  #84  
Old 07-31-2002, 08:12 AM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've updated the attachment in the original post. It contains a new weather.php file which has been adjusted for the new forecast raw data format output from MSNBC.

As for the icons, I'm still working on that issue.
Reply With Quote
  #85  
Old 07-31-2002, 08:28 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now it's your turn. You are the man!!!

All, I need to do is replace the weather.php file, right? Nothing else, right now? Do you know if this will take care of the blank page I get when I force update? That is the only real problem (besides the icons you are working on) that I am having with it.

Quote:
Originally posted by JJR512
I've updated the attachment in the original post. It contains a new weather.php file which has been adjusted for the new forecast raw data format output from MSNBC.

As for the icons, I'm still working on that issue.
Reply With Quote
  #86  
Old 07-31-2002, 08:36 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is a new pic of the weather after uploading the new weather.php. The temps look right now. Still getting the blank page on force update, but the rest is starting to look good now. Great job, sir!

Edit: Looks like the visibility and UV might be off a bit.
Reply With Quote
  #87  
Old 07-31-2002, 08:50 AM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Visibility and UV are fine. Right now, for Des Moines, MSNBC does not have visibility data, and the UV index is, aparently, 0 (or else not available, either).

You can always verify that what you see with this hack is correct by viewing what MSNBC's website says. Go here: http://www.msnbc.com/news/WEA_Front.asp?0dm=C---W Now this is important: Do NOT put in your zip code! That way gets you a different format of output that is not as easily compared to this hack. Instead, use the method under "Choose a region", it's just like picking your city from the hack.

If you do that and go to Des Moines, Iowa, you should see that (at this moment) it says -na- for visibility and 0 Minimal for UV.

As for your other questions...Yes, just upload the new weather.php (I think you already did that), and as far as I'm aware, that shouldn't fix whatever problem you're having with the forece update. I don't know what that problem is, since I'm not having it...
Reply With Quote
  #88  
Old 07-31-2002, 08:54 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, thanks. I just thought there might be something else they changed on you so that is why I let you know.

As far as the force update goes, no, that didn't make a difference. The wierd thing is, the very first time I used force update after installing it this time, it worked. But it hasn't worked since. But if I do a Modify Settings and just hit the submit button, it will update then just fine.

Quote:
Originally posted by JJR512
Visibility and UV are fine. Right now, for Des Moines, MSNBC does not have visibility data, and the UV index is, aparently, 0 (or else not available, either).

You can always verify that what you see with this hack is correct by viewing what MSNBC's website says. Go here: http://www.msnbc.com/news/WEA_Front.asp?0dm=C---W Now this is important: Do NOT put in your zip code! That way gets you a different format of output that is not as easily compared to this hack. Instead, use the method under "Choose a region", it's just like picking your city from the hack.

If you do that and go to Des Moines, Iowa, you should see that (at this moment) it says -na- for visibility and 0 Minimal for UV.

As for your other questions...Yes, just upload the new weather.php (I think you already did that), and as far as I'm aware, that shouldn't fix whatever problem you're having with the forece update. I don't know what that problem is, since I'm not having it...
Reply With Quote
  #89  
Old 07-31-2002, 11:45 AM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have updated the ZIP in the original post again. This time it does include some bigger changes, necessitate by the new icon system.

Both PHP files, weather.php and weather_functions.php, have been changed. A ZIP file named iconset5.zip has been added; this contains all the new icons. Note there is no 2.gif; I got a 404 while trying to get it, so I don't know if it doesn't exist or what. You should unzip it and get a folder named iconset5, then upload that folder to the same place as the other four iconset folders. As of now, iconset5 is the only usable set, because the icon meanings have changed, so you can delete the earlier four iconset folders if you want. Also, the template weather_main was changed so that iconset5 is hard-coded, and the new forecasted weather descriptions will appear under the icons; weather_select was changed to remove the icon selection part; and homeindex_left_weather was changed also to hard-code iconset5. If you have customized the templates at all, just look at the differences and you'll figure out what to do.
Reply With Quote
  #90  
Old 07-31-2002, 12:47 PM
scottct1 scottct1 is offline
 
Join Date: Mar 2002
Location: Connecticut
Posts: 391
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the quick fix! It is ALMOST all fixed but there appears to be a small problem.

Can you see whats wrong?



and



It's saying Flurries / Wind when its already close to 80 degrees here and there is almost no wind.

This happening to anyone else?
Reply With Quote
  #91  
Old 07-31-2002, 01:16 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems to be almost working. If I go to Modify Settings and hit submit, all of the icons show up for the 5-day forecast. When I go to the main page, the Current Weather shows up fine. When I go back to Detailed Forecast, I get the picture attached below (no icons). If I go back to Modify Settings and just hit submit, they show up again until I get out of it and come back in. Anyone else having this happen to them? (Still can't get Force Update to work without going to a blank page.)
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 07:23 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05524 seconds
  • Memory Usage 2,323KB
  • Queries Executed 25 (?)
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
  • (3)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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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