Link | weatherbug_getLocation |
Author | Shelane French |
Category | Utility |
Version | 8.x |
License | Public Domain |
Posted | 01 Apr 2007 |
Updated | 01 Apr 2007 |
More by this author... |
Returns location information (city, state, country) via the WeatherBug API.
Requires a valid WeatherBug API key. This tag also requires the [xml_tree]
type.
var: 'wbLocale' = weatherbug_getLocation(-key=$key, -zip=$zip); var: 'wbCurrentCity' = $wbLocale->find('location')->find('cityname'); var: 'wbCurrentState' = $wbLocale->find('location')->find('statename'); $wbCurrentCity ', ' $wbCurrentState;
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag( 'getLocation', -namespace='weatherbug_', -required='key', -required='zip', -priority='replace', -description='Returns location information for the given zip code.' ); local('url' = 'http://' + #key + '.api.wxbug.net/getLocationsXML.aspx'); local('getparams') = array( 'ACode' = #key, 'SearchString' = #zip ); local('response') = include_url( #url, -getparams=#getparams ); local('xmldata') = xml_tree(#response); local('out' = map); iterate(#xmldata->locations->children, local('i')); if(#i->name && #i->name != 'text'); local('map' = map); #map->insert('value' = #i->contents); if: #i->attributes; iterate: #i->attributes, (local: 'attribute'); #map->insert(#attribute->first = decode_xml(#attribute->second)); /iterate; /if; #out->insert(#i->name = #map); /if; /iterate; return(@#out); /define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft