Lasso Soft Inc. > Home

[yahoo_wordoftheday]

Linkyahoo_wordoftheday
AuthorJason Huck
CategoryUtility
Version8.x
Licensehttp://opensource.org/licenses/artistic-license.php
Posted05 Oct 2006
Updated05 Oct 2006
More by this author...

Description

Returns the Word of the Day from Yahoo! Education as a map containing the word, the definition, the publish date, and a permalink. Stores the results in a global which expires every 24 hours. Requires [xml_tree].

Sample Usage

var('myWord') = yahoo_wordoftheday;

'Word of the Day: ' 
    + $myWord->find('word') 
    + ' - ' 
    + $myWord->find('definition');

Source Code

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(
	'wordoftheday',
	-namespace='yahoo_',
	-priority='replace',
	-description='Returns the Word of the Day from Yahoo!'
);
	if(
		global_defined('yahoo_wotd')
		&& $yahoo_wotd->find('date')->difference(date, -hour) < 24
	);
		return($yahoo_wotd);
	else;	
		local('data') = xml_tree(string(include_url('http://xml.education.yahoo.com/rss/wotd/')));
		
		local('out') = map(
			'word' = #data->channel->item->title->contents->split(' - ')->first,
			'definition' = #data->channel->item->description->contents,
			'link' = 'http://education.yahoo.com/' + #data->channel->item->guid->contents,
			'date' = date_gmttolocal(date(#data->channel->item->pubDate->contents, -format='%a, %d %b %Y %H:%M:%S GMT'))
		);
		
		global('yahoo_wotd') = #out;			
		return(#out);
	/if;
/define_tag;

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft