[interchange-cvs] interchange - greg modified code/UserTag/timed_display.tag

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Tue Mar 25 14:14:42 EST 2008

User:      greg
Date:      2008-03-25 19:14:42 GMT
Added:     code/UserTag timed_display.tag
Tag to allow for date specific display of text or html in pages.

Revision  Changes    Path
1.1                  interchange/code/UserTag/timed_display.tag

rev 1.1, prev_rev 1.0
Index: timed_display.tag
UserTag timed-display Order	start stop
UserTag timed-display HasEndTag
UserTag timed-display Routine <<EOR
sub {
	my ($start, $stop, $body) = @_;

	my $now = $Tag->convert_date({ fmt => '%Y%m%d%H%M%S',});
	my $else = pull_else($body);

	if (!$start){
		$start = $now - 1;
	if (!$stop){
		$stop = '599900010000';#forever or at least after I die.

	$start = $Tag->convert_date({ fmt => '%Y%m%d%H%M%S', body => $start,});
	$stop = $Tag->convert_date({ fmt => '%Y%m%d%H%M%S', body => $stop,});

	return $body if !$start;

	if ($start < $now and $now < $stop){
		return $body;
	else {
		return $else;


UserTag timed-display Documentation <<EOD

Purpose: To allow for date specific display of text or html in pages.


[timed-display start=2007060608 stop=2007060612]
Some text/code to display between June 06, 2007 between 8am and Noon.

For open ended display you can just specify a start date. 
To start immediately and end on a specific date you can just specify a stop date.

The start and stop date use the convert_date tag, so you can use any format acceptable by that tag to specify your start and stop dates. (see convert_date documentation)


More information about the interchange-cvs mailing list