cf_expire

cf_expire

Version: 2.0 build 20041228
Requires: Adobe ColdFusion 5.0 or greater
Total size: 1.53 KB
Download time: 0.27 seconds at 56kbps
Edition: Freeware

Description

After a specified date, the content between the opening and closing cf_expire tags is ignored: HTML code is not displayed and CFML code is not processed. This is a convenient way of inserting a temporary message on a page. For example: NEW! . Now includes an embargo attribute. The content will not display before the embargo date.

Result

Selectively hides and skips content.

Category

flow control

Parameters


Parameter Type Required? Default Description
after string Yes A date written as a string
embargo string No A date written as a string

Custom tag source


 
<!---**
* cf_expire
* After a specified date, the content between the opening and 
* closing cf_expire tags is ignored:  code is not displayed
* and  code is not processed. This is a convenient way of 
* inserting a temporary message on a page. For example: 
* <cf_expire after="10 July 2004">NEW!</cf_expire>
* cf_expire now includes an embargo attribute. The content will 
* not display before the embargo date.
* 
* @param after            a date written as a string (required)
* @param embargo          a date written as a string
* @author Matthew Walker, WWW.eswsoftware.com
* @version 2, 2004-12-28 added embargo
* @version 1, 2004-06-10
*--->

<cfif thisTag.executionMode eq "start">
  <cfparam name="attributes.after">
  <cfparam name="attributes.embargo" default="">
  
  <cfparam name="request.eswsoftware" default="#structNew()#">
  <cfparam name="request.eswsoftware.expire" default="#structNew()#">
  <cfset request.eswsoftware.expire.version = 2>

  <cfif len(attributes.embargo)>
    <cftry>
      <cfset embargoDate = lsParseDateTime(attributes.embargo)>
      <cfcatch>
        <cfset embargoDate = parseDateTime(attributes.embargo)>
      </cfcatch>
    </cftry>
	<cfif dateCompare(embargoDate, now()) eq 1>
      <cfexit>
    </cfif>
  </cfif>
  
  <cftry>
    <cfset expiryDate = lsParseDateTime(attributes.after)>
    <cfcatch>
      <cfset expiryDate = parseDateTime(attributes.after)>
    </cfcatch>
  </cftry>
  <cfif dateCompare(expiryDate, now()) eq -1>
    <cfexit>
  </cfif>
  
</cfif>
World Wide Web
ColdFusion Markup Language: Tag-based language processed by a ColdFusion web application server
HyperText Markup Language
The coding language used to create hypertext documents for use on the World Wide Web.