[yahoo_wordoftheday]

Description

Link: [yahoo_wordoftheday]
Author: Jason Huck
Category: Utility
Version: 8.x
License:
Posted: Oct. 05, 2006
Updated: Jan. 01, 0001
More by this author...
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].

Parameters

none


Sample Usage

var('myWord') = yahoo_wordoftheday;

'Word of the Day: <a href="' 
    + $myWord->find('link') 
    + '" target="_blank">' 
    + $myWord->find('word') 
    + '</a> - ' 
    + $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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net