Custom Search

Wednesday, May 14, 2008

Tutorial : Hold Output



Coldfusion Tutorial : Hold Output

Description
A simple techniqe for hold coldfusion page output for a few time.

Example

holdoutput.cfm


<cfflush interval="1">

<cfset startTime=TimeFormat(Now(),"hh:mm:ss")>
<cfset stopTime=TimeFormat(DateAdd("s",30,startTime),"hh:mm:ss")>
<cfset endTime=TimeFormat(DateAdd("s",1,startTime),"hh:mm:ss")>

<cfoutput>Start Time : #startTime#</cfoutput><br/>
<hr/>
<cfloop condition=" startTime NEQ endTime">
 <cfset startTime=TimeFormat(Now(),"hh:mm:ss")>
 <cfif startTime EQ endTime>
  <cfoutput>Now Time : #endTime#</cfoutput><br/>
  <cfset endTime=TimeFormat(DateAdd("s",1,startTime),"hh:mm:ss")>
 </cfif>
 <cfif startTime GTE stopTime>
  <cfbreak>
 </cfif>
</cfloop>

   


Example Output