Localized weather plugin working……
Chris Curtis has come through for me.
After trying to get this weather plugin to accept a variable input of any kind without sucess, Chris wrote up a little php mysql query.
Here is the php portion that’ll go at the top of the page:
code snippet is too long. email me at jakecovert[at]comcast[dot]net and I'll email.
And here is the plugin portion. Notice that instead of just putting the location code (such as KDET) in, Chris put in php call.
code snippet is too long. email me at jakecovert[at]comcast[dot]net and I'll email.
The only down side (and not a big one to me, as my membership is small) is that you will have to manually create the variable in question (easy) and populate it with some data (not too bad). Someone else did mention being able to modify the “create new user” screen or such to have users do it themselves though.
I wanted to say thanks to Chris and his excellent php / mysql query skills.
Here is the first bit of code:
<?php
global $SESS;
// // Grab the location code from the database // $sql = “SELECT m_field_id_1 FROM exp_member_data WHERE member_id = ‘”.$SESS->userdata[‘member_id’].”’ LIMIT 1”;
$result = mysql_query($sql);
list($locationcode) = mysql_fetch_row($result);
?>
And here is the second little bit:
{if logged_in} <h2 class=”sidetitle”>Your Local Weather</h2>
{exp:world_weather:current station="<?php echo $locationcode; ?>" cache_refresh="300"} Temperature: {temperature_f}°F<br /> Feels Like: {feels_like_f}°F<br /> Humidity: {humidity}%<br /> Conditions: {condition}<br /> Wind: from the {wind_direction} at {wind_speed_mph} mph<br> Last Updated: {last_update format="%m/%d/%Y %g:%i %a"}<br> {/exp:world_weather:current} {/if}
This is a great plugin & I’ve got it to work right away! Sue, any chance of giving me a hint on how you got to work an if statement showing, sun, clouds and all? PS: I can see this post is about 4 years old, but I’m someone has still their hands dirty with this one. Cheers!
I was wondering the same!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.