[mf_datetime]

Description

Link: [mf_datetime]
Author: Jason Huck
Category: String
Version: 8.5.x
License: Public Domain
Posted: Sep. 07, 2010
Updated: Jan. 01, 0001
More by this author...

Returns the given date in the datetime design pattern microformat. Will use an <abbr> tag unless -html5 equals true, in which case it will use a <time> tag.

Parameters

none


Sample Usage

mf_datetime( -class='published', -html5=true);

// <time class="published" datetime="2010-09-07 16:13:24 -0400">07 Sep 2010</time>
						

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
27
define_tag(
	'datetime',
	-namespace='mf_',
	-req='class',
	-opt='date', -type='date',
	-opt='format',
	-opt='id',
	-opt='html5', -type='boolean',
	-priority='replace',
	-encodenone,
	-description='Returns the given date in the datetime design pattern microformat.'
);
	!local_defined('date') ? local('date') = date;
	!local_defined('format') ? local('format') = '%d %b %Y';
	!local_defined('html5') ? local('html5') = false;
	
	local('out') = (#html5 ? '<time ' | '<abbr ');		
	local_defined('id') ? #out += 'id="' + #id + '" ';
	#out += 'class="' + #class + '" ';	
	#out += (#html5 ? 'datetime' | 'title');		
	#out += '="' + #date->format('%Y-%m-%d %H:%M:%S %z') + '">';		
	#out += #date->format(#format);		
	#out += (#html5 ? '</time>' | '</abbr>');

	return(#out);
/define_tag;

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net