| Added Current Local Weather w/5 day forecast... | |
Posted: 09/15/2005 6:40 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 2:31 AM
Location: St Pete, FL
|
|
|
|
|
|
I added the Current Local Weather w/5 day forecast display to our Index page, which allows registered members to pick a city from within the profile and have the current and 5 day forecast displayed on our Index page. If no city is selected or an invalid code is entered, then no weather is displayed. Guests will see nothing...
We can all thank SwissCheese for pointing this MOD out for us to enjoy...
|
|
Last edited by Nightrider on 09/19/2005 4:55 AM; edited 1 time in total |
|
|
|
Back to Top |
|
|
| Re: Added Current Local Weather w/5 day forecast... | |
Posted: 09/15/2005 10:46 AM |
|
|
|
|
Site Admin |
Posts |
49593 |
Word Cnt. |
2,756,445 |
BDay |
Apr 22 |
Sign |
Taurus |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 12:31 AM
Location: Texas
|
|
|
|
|
|
Now this is NEAT! Thank you SwissCheese for telling us about it and thank you Nightrider for installing it!
|
|
|
|
|
Back to Top |
|
|
| Re: Added Current Local Weather w/5 day forecast... | |
Posted: 09/15/2005 11:51 AM |
|
|
|
|
Citation |
Posts |
3489 |
Word Cnt. |
137,488 |
BDay |
Mar 5 |
Sign |
Pisces |
Sex |
|
|
|
|
Joined: Oct 14, 2004
Local time: 1:31 AM
Location: Texas
|
|
|
|
|
|
Thank you, Nightrider and SwissCheese! That's a handy MOD.
|
|
|
|
|
Back to Top |
|
|
| Re: Added Current Local Weather w/5 day forecast... | |
Posted: 09/15/2005 2:26 PM |
|
|
|
|
Swan |
Posts |
147 |
Word Cnt. |
13,187 |
BDay |
Mar 7 |
Sign |
Pisces |
Sex |
|
|
|
|
Joined: Jul 29, 2005
Local time: 8:31 AM
Location: Zürich, Switzerland
|
|
|
|
|
|
You are welcome Nightrider, rb2d2xp and bigR...
Nightrider I thought you might be interested in this Patch I wrote for the Weather MOD...
Code:
|
##############################################################
## MOD Title: Patch for Weather MOD
## MOD Author: SwissCheese < N/A > (Daniel Schaad) http://www.RafikiTalk.com
## MOD Description: A: Only calls function when user is logged in.
## B: Prevents remote hotlinking.
## C: Fixes broken HTML on errors.
## D: Adds user friendly messages for these errors:
## 1) no Weather City Code provided
## 2) wrong Code provided or weather server unavailable
##
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: ~1 Minutes
##
## Files To Edit: 3
## index.php
## includes/weather.php
## language/lang_english/lang_main.php
##
## Included Files: (n/a)
##
## License: http://opensource.org/licenses/gpl-license.php GNU Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
##
## Author Notes: the Weather MOD must be installed
## before this patch can be applied!
##
##
## DEMO: http://www.RafikiTalk.com
## (you'll need to register to see the patch in action)
##
##
## bug A: the original MOD queried the weather server regardless
## of whether it was needed (user logged in) or not.
## fix A: MOD now checks if user is logged in before calling the
## function
##
##
## bug B: the original MOD could be called remotely by hotlinking.
## fix B: added if(!defined('IN_PHPBB')){die("Hacking attempt");}
##
##
## bug C: the original MOD breaks the HTML of the index_body.tpl when
## the City Code is not provided or the server is not available.
## fix C: instead of parsing the remainder of the $gotWeather variable,
## (which eventually adds </td></tr></table> to its 'empty' self
## causing the HTML to break) the function returns straight to
## the calling point when an error occurs.
##
##
## bug D: the original MOD returns the same Error Message regardless
## of whether the Weather City Code is missing or incorrect,
## or whether the Weather Server is unavailable.
## fix D: this patch makes the MOD more user friendly by returning
## the following error messages (which both also provide a
## link to the users profile) for these two possible cases:
##
## case 1: logged in, no code provided
## before: No City Selected
## after: No City Selected: click here to enter a Weather City Code in your profile...
##
## case 2: logged in, wrong code provided or weather server unavailable
## before: No City Selected
## after: Unable To Retrieve Weather Data
## Either the weather server is temporarily unavailable,
## or the Weather City Code in your Profile is incorrect.
##
##
##############################################################
## MOD History:
##
## 2005-09-15 - Version 1.0.0
## - Initial Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
'MY_WEATHER' => weather($zip_code),
#
#-----[ REPLACE WITH ]----------------------------------------
#
'MY_WEATHER' => ($userdata['session_logged_in']) ? weather($zip_code) : '',
#
#-----[ OPEN ]------------------------------------------------
#
includes/weather.php
#
#-----[ FIND ]------------------------------------------------
#
function weather($weather_code)
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}
#
#-----[ FIND ]------------------------------------------------
#
global $lang;
#
#-----[ REPLACE WITH ]----------------------------------------
#
global $lang, $phpEx;
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( !$weather_code )
{
$noWeather = '<td wrap="nowrap"><br /><span class="gen">' . sprintf($lang['weather_no_city_selected'], '<a href="' . append_sid("profile.$phpEx?mode=editprofile") . '">', '</a>') . '</span><br /><br /></td>';
return $noWeather;
}
#
#-----[ FIND ]------------------------------------------------
#
if ($weatherData == "")
{
$gotWeather = $lang['no_city_selected'];
}
#
#-----[ REPLACE WITH ]----------------------------------------
#
if ( !$weatherData )
{
$noWeather = '<td align="center" wrap="nowrap"><br /><span class="gen">' . sprintf($lang['weather_not_retrieved'], '<a href="' . append_sid("profile.$phpEx?mode=editprofile") . '">', '</a>') . '</span><br /><br /></td>';
return $noWeather;
}
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------------
#
$lang['no_city_selected'] = 'No City Selected';
#
#-----[ REPLACE WITH ]----------------------------------------
#
$lang['weather_no_city_selected'] = 'No City Selected: click %s<u>here</u>%s to enter a Weather City Code in your profile...';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['weather_not_retrieved'] = 'Unable To Retrieve Weather Data<br /><br />Either the weather server is temporarily unavailable,<br />or the Weather City Code in %s<u>your Profile</u>%s is incorrect.';
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM
|
...it fixes several issues, like querying the Weather Server
when guests visit (which is totally unnecessary) and some
others... details are in the MOD...
~enjoy
PS:
you can see the different error
messages at www.RafikiTalk.com
Try a) deleting the city code
and b) provide a wrong code |
|
|
|
|
Back to Top |
|
|
| Re: Added Current Local Weather w/5 day forecast... | |
Posted: 09/16/2005 1:10 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 2:31 AM
Location: St Pete, FL
|
|
|
|
|
|
Thanks SwissCheese. I applied this patch and all seems to be well. I haven't tested it yet. But since it didn't crash the board and since the weather continues to function, I'm a happy camper...
|
|
|
|
|
Back to Top |
|
|
| Re: Added Current Local Weather w/5 day forecast... | |
Posted: 10/25/2005 4:30 AM |
|
|
|
|
Citation |
Posts |
428 |
Word Cnt. |
24,335 |
BDay |
N/A |
Sign |
N/A |
Sex |
|
|
|
|
Joined: Sep 20, 2005
Local time: 1:31 AM
|
|
|
|
|
|
nicely done n scared the crap outa me..lol i never noticed it b4... it jumped out at me
heheheheheh im impressed i like it:) |
|
|
|
|
Back to Top |
|
|
| Added Current Local Weather w/5 day forecast... | |
Posted: 10/26/2005 11:08 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 2:31 AM
Location: St Pete, FL
|
|
|
|
|
|
I'm glad you like it Peggy. While I was looking through the data, I noticed that you had assigned your City code incorrectly. A lot of people have, so it's no big deal. I need to make the message a bit clearer. Also there needs to be some code to prevent people from making the same mistake. I couldn't assign your town, but I got as close as I could...
|
|
|
|
|
Back to Top |
|
|
| Re: Added Current Local Weather w/5 day forecast... | |
Posted: 10/26/2005 11:11 AM |
|
|
|
|
Swan |
Posts |
147 |
Word Cnt. |
13,187 |
BDay |
Mar 7 |
Sign |
Pisces |
Sex |
|
|
|
|
Joined: Jul 29, 2005
Local time: 8:31 AM
Location: Zürich, Switzerland
|
|
|
|
|
|
Nightrider wrote:
|
I noticed that you had assigned your City code incorrectly. Â A lot of people have...
|
Like how? enter a real city name?
That is what my users do sometimes... |
|
|
|
|
Back to Top |
|
|
| Added Current Local Weather w/5 day forecast... | |
Posted: 10/26/2005 11:28 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 2:31 AM
Location: St Pete, FL
|
|
|
|
|
|
Yes, they either enter their City or Zip Code. Neither will work though. There has to be a better way to handle this than they have...
Post generated using Mail2Forum (http://4fxearth.net/phpBB2) |
|
|
|
|
Back to Top |
|
|
| Re: Added Current Local Weather w/5 day forecast... | |
Posted: 10/26/2005 8:27 PM |
|
|
|
|
Citation |
Posts |
428 |
Word Cnt. |
24,335 |
BDay |
N/A |
Sign |
N/A |
Sex |
|
|
|
|
Joined: Sep 20, 2005
Local time: 1:31 AM
|
|
|
|
|
|
huh? what ? where? your lying? lol show me or tell me what your talkin bout hun? |
|
|
|
|
Back to Top |
|
|
| Information | |
Welcome to RCF - WHF Forum Index
-> Announcements
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
All times are GMT - 5 Hours
Page 1 of 1
Add To Bookmarks
|
|
|
|