TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 271
  • Total: 271

[Block] New Weather Channel

Started by darkorical, September 21, 2009, 08:16:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

darkorical

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

Ken.

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
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

jdvarner

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.

darkorical

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

This website is proudly hosted on Crocweb Cloud Website Hosting.