[Request] Weather Block

Mods etc.

Moderator: Integra Moderator

[Request] Weather Block

PostAuthor: davidgreen73 » Wed Aug 30, 2006 7:10 am

I have found a few PHP weather mods but nothing is really grabbing me, as none I have found will do forecasts. I was thinking default would be current weather and then click to get a 10 day or something to that nature. Does anyone have a weather mod they can share? I would like to integrate it as a block.
Last edited by davidgreen73 on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

davidgreen73
Newbie
Newbie
 
Posts: 7
Likes: 0 post
Liked in: 0 post
Joined: Fri Aug 25, 2006 9:42 am
Cash on hand: 0.00

Re: [Request] Weather Block

PostAuthor: dsears » Fri Sep 01, 2006 7:43 am

David,

I kept mine very simple. Create a new block file and include this one line in the tpl file:

<script></script>

Replace 99999 with your zip code and there you have it.
Last edited by dsears on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
User avatar
dsears
Newbie
Newbie
 
Posts: 1
Likes: 0 post
Liked in: 0 post
Joined: Mon Jun 05, 2006 10:58 am
Cash on hand: 0.00

Re: [Request] Weather Block

PostAuthor: BMD » Mon Sep 04, 2006 6:34 am

David

Here is what I came up with.

This will allow your users to see THEIR weather... not just your's.

open your editor of choice
create a file called: local_cond.php
cut and paste the following

Code: Select all
<?php if (isset($_COOKIE["YOUR FORUM COOKIE NAME_sid"])) { $weathercookie = $_COOKIE["YOUR_COOKIE_NAME_sid"]; } $server = "mysql.YOUR_SITE.com"; $user = "YOUR_ACCOUNT_NAME"; $password = "YOUR_PASSWORD"; $database = "YOUR_DATABASE";$connect=mysql_connect($server,$user,$password); mysql_select_db($database) or die(mysql_error()); $who_am_i="SELECT `session_user_id` FROM `forum_sessions` WHERE `session_id`= '$weathercookie'";$weather_user = mysql_query($who_am_i,$connect);$count_rows = mysql_num_rows($weather_user); if($count_rows == 1) { $weather_id = mysql_fetch_assoc($weather_user); }$my_weather_id=$weather_id[session_user_id];$get_zip =("SELECT `user_zip` FROM `forum_users` WHERE `user_id`= $my_weather_id");$user_zip= mysql_query($get_zip);$count_rows2 = mysql_num_rows($user_zip); if($count_rows2 == 1) { $zip_id = mysql_fetch_assoc($user_zip); }$my_weather_zip=$zip_id[user_zip];mysql_close();$loc_weather='http]

in the above edit

[code]if (isset($_COOKIE["YOUR FORUM COOKIE NAME_sid"])) { $weathercookie = $_COOKIE["YOUR_COOKIE_NAME_sid"]; } $server = "mysql.YOUR_SITE.com"; $user = "YOUR_ACCOUNT_NAME"; $password = "YOUR_PASSWORD"; $database = "YOUR_DATABASE";[/code]

by filling in your specific entries



add a folder to your forum root called weather ([url=http]http://www.YOUR_SITE.com/FORUM_ROOT/weather[/url])

upload the local_cond.php to the weather folder



you need to add a zip code to your PCP

open your ACP and go to PCP
clcik "Fields Deffinition"
scroll to the bottom and click "Add a new field"
in base deffinitions fill in the following:

Field name:. user_zip
Legend of the field: User zip code
Explanation of the field: This is used to get your local CURRENT weather conditions


Click the OUTPUT TAB
set the following
CLASS: real
TYPE: VARCHAR
Display the text value: YES (all others to NO)


Click the INPUT TAB
Required field: YES (others to NO)
Get Mode: VARCHAR
Values List: NONE
Authe Level: Registered Users

Click SUBMIT

Click Here to create field in users table (DO THIS)
Set following
Type: VARCHAR
Length: 5
Unsigned: NO
Null Allowed: NO
Default Value: YOUR ZIP CODE (5 digit number)
UNCHECK: allow null
click sibmit

*** You should now have the field created and the filed added to your user table in your SQL database***

go back to PCP and click "PCP Wizard"
click add/remove page fields

in the left column of fields scroll down to fine the filed you just created "user_zip"
highlight it and click -> (this adds the filed ot your user reg page)
now in the RIGHT column find and highlight "user_zip"
click move up as many times as it takes to move "user_zip" so that it is under "user_state"
click submit

you should now have the "user_zip" added to your user profile.

Click IM Portal in ACP
Click Blocks Management
choose your portal page to add a block to
at the bottom find and click "ADD BLOCKS"

Name the Block: Local Weather Conditions
choose your block possition (header center footer etc)
activate the block
add the following in the text entry
[code]for [color=darkred][b][i][you]'s[/i][/b][/color] area.[web:37n3zd4r]http://www.YOUR_SITE.com/YOUR_FORUM ROOT/weather/local_cond.php[/web:37n3zd4r]

set the type to BBCODE
set following
Show Border: Yes
Show Titlebar: Yes
Localize Titlebar: Yes
Show BG: Yes
Click submit

THAT'S IT ..... your registered users should see either their local weather or if they do not chenge the default you set you local weather.

hope this does what you want.... works great for me and my users

Cheers BMD

go to :la: to see what it loos like

it's in the footer column on the right of the portal page
Last edited by BMD on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

BMD
Members
Members
 
Posts: 84
Likes: 0 post
Liked in: 0 post
Joined: Thu Aug 24, 2006 4:12 am
Cash on hand: 0.00


Return to IntegraMOD Modifications

Who is online

Registered users: Bing [Bot], Google [Bot], Helter, Majestic-12 [Bot]