vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   vB Weather Mk. 2 (https://vborg.vbsupport.ru/showthread.php?t=41842)

Boofo 08-05-2002 12:40 AM

Try it now, Erwin. It just kicked in for some reason. All is working well. :)

Erwin 08-05-2002 12:43 AM

Okay, it was probably a temporary weather server problem - everything is working perfectly now! :)

Thanks for your great work JJ!!!

JJR512 08-05-2002 12:44 AM

If someone just tried to contact me via AIM in regards to this hack, please try again. The message "Do you wish to accept a message from this person" popped up right as I was in the middle of typing something, right as I was about to hit the space bar, and I guess the space bar dismisses that message. I didn't even get to see who it was, but this hack is the only reason I can think of why anyone I don't already have on my list would want to contact me now...so whoever you are, I apologize, I did not mean to cancel your request. Please try again! :)

Ian 08-05-2002 01:16 AM

I attactched it if anyone needs me... I did it by hand so it's not the most even but here you go:

JJR512 08-05-2002 01:16 AM

Quote:

Originally posted by Itworx4me
Hi all,

I hope JJR512 doesn't mine. I added this to his hack. This will tell you what city,state, and country right after Your Current Weather. This will show on your forum home page. Your Current Weather For (City),(state),(country).

Find in forumhome_weather template
Code:

Your Current Weather
Then Add this right after Weather
Code:

For $weatherdata[city], $weatherdata[subdiv], $weatherdata[country]

Thanks for a wonderful hack JJR512

Sorry, I had meant to do this...I have code in weather.php which allows a subdivision name to show up as well, if there is one for the current location. I've updated the instructions to add this bit of code to the code added to index.php, and the forumhome_weather template. So, basically, re-do the instructions for index.php (remove the code you added before and add the new code now in the instructions), and replace the forumhome_weather template with the new version.

Erwin 08-05-2002 01:45 AM

I've already customized the template - can you just post and tell us what the changes actually are? Is it just the addition of $weatherdata[subdiv] in the template? What changes need to be done in the index.php?

Erwin 08-05-2002 01:47 AM

I see it. :)

I'll change it manually myself - thanks! Sorry to bother you.

Boofo 08-05-2002 01:51 AM

Ok, Erwin, the ball's in your court. Can you tell us the changes? :)

Quote:

Originally posted by Erwin
I see it. :)

I'll change it manually myself - thanks! Sorry to bother you.


Erwin 08-05-2002 01:55 AM

To upgrade from version v1.0 to v1.0a - this post has been updated - it works. :)

In forumhome_weather template, find:

Code:


<smallfont><img src

REPLACE with:

Code:


<smallfont>
$weatherdata[city], $weatherdata[showsubdiv]$weatherdata[country]<br>
<img src

NOTE: The variable is $weatherdata[showsubdiv], NOT $weatherdata[subdiv]

Then, in index.php...

Find:

PHP Code:


  
eval("\$currentweather = \"".gettemplate("forumhome_weather")."\";"); 

ABOVE it, add:

PHP Code:


  
if ($weatherdata[subdiv]) {
    
$weatherdata[showsubdiv] = "$weatherdata[subdiv], ";
  } else {
    
$weatherdata[showsubdiv] = "";
  } 

That should do it. If there's a subdivision, it will show up, and if not, it won't.

JJR512 08-05-2002 02:04 AM

The code addition is correct.

But in my version, in the forumhome_weather template, the bit you say to find isn't there. But you do have the addition correct, and it goes after "Current Weather" in that template (I believe originally, it was "Your Current Weather").

Erwin 08-05-2002 02:26 AM

You're right JJ, I was upgrading from my own customized template... I've updated my post - just follow the instructions and you will upgrade from v1.0 to v1.0a :)

Boofo 08-05-2002 02:44 AM

You might want to update it again and use the disable tags so it won't show the vbulletin.org path to the image file. :)

Quote:

Originally posted by Erwin
You're right JJ, I was upgrading from my own customized template... I've updated my post - just follow the instructions and you will upgrade from v1.0 to v1.0a :)

skyline2002 08-05-2002 02:48 AM

JJR512:

thanks for your new version. there is the another way to let the old version weather hack work.

as i know ,in the old version, only the high & low TEMP of Forecast Day of Week and icons did not work any more since MSN has changed their source provider .

so if we want to let the high & low temp works in old version, just have to make little changes like below:

in weather.php
find:
---------------------------------------------
// Forecast Highs
$weatherdata[forecasthigh1] = convert_temp($forecast[15],$usersettings[tpc]);
$weatherdata[forecasthigh2] = convert_temp($forecast[16],$usersettings[tpc]);
$weatherdata[forecasthigh3] = convert_temp($forecast[17],$usersettings[tpc]);
$weatherdata[forecasthigh4] = convert_temp($forecast[18],$usersettings[tpc]);
$weatherdata[forecasthigh5] = convert_temp($forecast[19],$usersettings[tpc]);

// Forecast Lows
$weatherdata[forecastlow1] = convert_temp($forecast[25],$usersettings[tpc]);
$weatherdata[forecastlow2] = convert_temp($forecast[26],$usersettings[tpc]);
$weatherdata[forecastlow3] = convert_temp($forecast[27],$usersettings[tpc]);
$weatherdata[forecastlow4] = convert_temp($forecast[28],$usersettings[tpc]);
$weatherdata[forecastlow5] = convert_temp($forecast[29],$usersettings[tpc]);
------------------------------------------

replace with:
-------------------------------------------
// Forecast Highs
$weatherdata[forecasthigh1] = convert_temp($forecast[20],$usersettings[tpc]);
$weatherdata[forecasthigh2] = convert_temp($forecast[21],$usersettings[tpc]);
$weatherdata[forecasthigh3] = convert_temp($forecast[22],$usersettings[tpc]);
$weatherdata[forecasthigh4] = convert_temp($forecast[23],$usersettings[tpc]);
$weatherdata[forecasthigh5] = convert_temp($forecast[24],$usersettings[tpc]);

// Forecast Lows
$weatherdata[forecastlow1] = convert_temp($forecast[40],$usersettings[tpc]);
$weatherdata[forecastlow2] = convert_temp($forecast[41],$usersettings[tpc]);
$weatherdata[forecastlow3] = convert_temp($forecast[42],$usersettings[tpc]);
$weatherdata[forecastlow4] = convert_temp($forecast[43],$usersettings[tpc]);
$weatherdata[forecastlow5] = convert_temp($forecast[44],$usersettings[tpc]);

-------------------------------------------

for icons, just replace old icons with new icons from jj's version!
or rename the old icons.

now, you old version should works fine.

sorry about my poor english. hope you guys understand me!

enjoy!!

Erwin 08-05-2002 03:37 AM

Quote:

Originally posted by Boofo
You might want to update it again and use the disable tags so it won't show the vbulletin.org path to the image file. :)


The disable tags didn't want to work, so I modified my post to remove the { imagesfolder} bits... :) You don't need them.

snyx 08-05-2002 06:12 AM

Quote:

Originally posted by snyx
JJR512 would it be too much trouble to make say.. 3 preset weather locations (ie. Vancouver, Seattle, Toronto) and even if the user hasnt selected any of them for their own use, they could click a link to take them to that places weather?
sorry :lick: just curious..

snyx 08-05-2002 06:13 AM

hahaha, and again..
how would I change the default location (New York) when your not loggedin/or registered.. to another location?

JJR512 08-05-2002 06:07 PM

I believe I put instructions for that (changing the default city) near the end of instructions.txt; it starts with "OPTIONAL". :)

snyx 08-05-2002 06:29 PM

thanks man, I will check that out.

chris2707 08-05-2002 06:49 PM

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

Crazy Mofo 08-05-2002 07:26 PM

Database error in vBulletin 2.2.5:

Invalid SQL: SELECT subdivid FROM weather_city WHERE accid='USNY0996'
mysql error: Table '*****_db2.weather_city' doesn't exist

!!

JJR512 08-05-2002 09:26 PM

I guess you didn't do Steps 2 and/or 3 in the instructions.

JJR512 08-05-2002 09:32 PM

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"! :D

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.

JJR512 08-05-2002 09:36 PM

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?

chris2707 08-06-2002 06:35 AM

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

JJR512 08-06-2002 04:12 PM

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.

Boofo 08-06-2002 04:17 PM

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.

JJR512 08-06-2002 04:20 PM

You have read Post #s 60 and 63-66, right?

reifegerste 08-06-2002 04:22 PM

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

Boofo 08-06-2002 04:31 PM

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?

JJR512 08-06-2002 04:32 PM

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.

reifegerste 08-06-2002 04:40 PM

where can i find the new weather.php?

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

:paranoid:

JJR512 08-06-2002 04:43 PM

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. :)

reifegerste 08-06-2002 04:54 PM

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)

reifegerste 08-06-2002 04:55 PM

oh sorry


my cache was incorrect :D

this hack is great!!!

chris2707 08-06-2002 05:15 PM

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.



PhoenixBB 08-06-2002 07:12 PM

This is a great hack. Thank you!

Got a couple of probs tho......

1) The table and default data comes up fine, but the 'Change Settings' and 'Get More Detailed Forecast. don't work. The pages loads but it just contains my header and background, nothing else. What am I doing wrong??

2) I don't actually want it on my forums page, I'm using VPBLite, so I want a vertical box like the ones on phpportals. I managed to get it into that format ok, but how would I get it to appear on the portal page? I've given up on making it a 'block'. I tried adding the info to the 'vpbincfile' (which generates the portal page), instead of the index, and putting the variable into the portal template instead of the forumhome, but it won't appear. Any ideas?

Boofo 08-06-2002 07:24 PM

Ok, I see what you are saying now. What I was looking for is the time that my site went out and got the update, whether is be automatically or through force update type setting (since I can't do force update and have to do it through settings, I will call it that). They must be going by the server time itself on MSNBC then.

If you come up with the time conversion, I would be very interested in trying it out. Thank you. :)

Quote:

Originally posted by chris2707
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.



JJR512 08-06-2002 08:06 PM

Quote:

Originally posted by PhoenixBB
This is a great hack. Thank you!

Got a couple of probs tho......

1) The table and default data comes up fine, but the 'Change Settings' and 'Get More Detailed Forecast. don't work. The pages loads but it just contains my header and background, nothing else. What am I doing wrong??

2) I don't actually want it on my forums page, I'm using VPBLite, so I want a vertical box like the ones on phpportals. I managed to get it into that format ok, but how would I get it to appear on the portal page? I've given up on making it a 'block'. I tried adding the info to the 'vpbincfile' (which generates the portal page), instead of the index, and putting the variable into the portal template instead of the forumhome, but it won't appear. Any ideas?

I cannot support this hack for anything but vBulletin. If you are using vbPortal, there is a weather feature for that, which looks and works just like this. But, it was written specifically to work with vbPortal, which, although based on vBulletin, is a bit different. You could take mine and adapt it to vbPortal, but by then you'd have what someone else already did, so you may as well just get the one that's already made.

If whoever is responsible for that add-on to vbP hasn't updated it yet (last time I checked phpportals.com, they hadn't yet), they're welcome to take a look at mine to see what the changes are. And that would be the greatest of ironies, too, considering the fact that I wrote my hack because I couldn't get theirs without paying. :)

JJR512 08-06-2002 09:32 PM

OK, I have uploaded a new ZIP which should show the time of the last update in the user's own local time zone. I have tested it on my own board and it seems to work fine, but let me know if there are any issues. Please note the time shown is the time stamp in the raw data that was last cached for the user. In other words, if a user sees the weather and this gets cached, then right after that, MSNBC releases a new raw data set, the user will still see the cached data, including the time stamp from it (adjusted for local time zone, of course), until the cache expires (by default after two hours), or the user does a force update.

If you already have an earlier version installed, here's how you upgrade. Upload the new weather.php file. Next, open index.php, and find
Code:

  eval("\$currentweather = \"".gettemplate("forumhome_weather")."\";");
Above that, add:
Code:

  $time_lastup = strtotime($weather[lastup]);
  $weather[updatedate] = vbdate($dateformat,$time_lastup);
  $weather[updatetime] = vbdate($timeformat,$time_lastup);

(Note: You can perform the same change to your existing weather.php if for some reason you don't want to upload the new one.)

Now you need to change two templates: weather_main and forumhome_weather. Do the same change to both templates. Find:
Code:

Time of last update: $weatherdata[lastup]
Change to:
Code:

Time of last update: $weather[updatedate] at $weather[updatetime]
Remember, do this to both the forumhome_weather and weather_main templates.

***
If you've already installed this hack, you needn't worry about it, but, for the record, I've broken the weather_city.sql file into six smaller parts would should be easier for many websites to import without timing out.

PhoenixBB 08-06-2002 09:47 PM

Quote:

Originally posted by JJR512

I cannot support this hack for anything but vBulletin. If you are using vbPortal, there is a weather feature for that, which looks and works just like this. But, it was written specifically to work with vbPortal, which, although based on vBulletin, is a bit different. You could take mine and adapt it to vbPortal, but by then you'd have what someone else already did, so you may as well just get the one that's already made.
Except I'd have to pay $20 to get it and I can't afford it at the moment. Plus they haven't updated it yet.

The old one worked - not in the blocks but it rendered on the portal page. This one appears to only render when the code is in the index.php and the variable is on the forum page. Regardless of where I put it tho, the fact remains that even on the forum home page I cannot change the settings or get a detailed forecast. I just get a blank page. Is this fixable, or is this because the of the portal (which is only the lite version and shouldn't interfere with anything).

Obviously if users can't change the settings it will be unusable. :(


All times are GMT. The time now is 02:47 AM.

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.01753 seconds
  • Memory Usage 1,854KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (2)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete