TinyPortal

Development => Block Codes => Topic started by: darkorical on September 21, 2009, 08:16:06 PM

Title: [Block] New Weather Channel
Post by: darkorical on September 21, 2009, 08:16:06 PM
alright the old posted Weather Channel block doesn't seem to work and it seems google isn't always reliable to make sure their xml feed is up 100% of the time for my other weather block so I tossed this together.

this one requires a zip code to function properly but it does a better job of checking to make sure its working

This Goes in a script box


global $ID_MEMBER, $context,$memberContext;
loadMemberData($ID_MEMBER);
loadMemberContext($ID_MEMBER);
if (($memberContext[$ID_MEMBER]['location'] == "") || (!is_numeric($memberContext[$ID_MEMBER]['location']))){echo 'If you enter your Zip Code on your profile this block will show you your local weather.';}
else{
echo'<script type="text/javascript" src="http://voap.weather.com/weather/oap/'.$memberContext[$ID_MEMBER]['location'].'?template=GENXV&par=3000000007&unit=0&key=twciweatherwidget"></script>';}



I cannot offer a demo as I do not have a live site I only use an intranet server and site for my company
Title: Re: [Block] New Weather Channel
Post by: Ken. on September 21, 2009, 09:05:17 PM
Works good, thanks for posting darkorical. :up:



There are a couple of details that you should add to your OP:
Code goes in a PHP block.
Zip code goes in the members "Forum Profile Information>Location"


DEMO (http://www.ourfamilyforum.org/tptest2/index.php)
Title: Re: [Block] New Weather Channel
Post by: jdvarner on September 25, 2009, 05:12:16 AM
The only bad thing is you have to modify the location field in order to use it. If would be cool if it recognized... San Antonio, Tx instead of using the zip code.

Cool though.
Title: Re: [Block] New Weather Channel
Post by: darkorical on September 26, 2009, 04:10:21 AM
I'm eventually look into combining my weather (and possible other location dependent blocks) with the custom profile fields mod and see if the blocks can be improved