How do I make a template pause(sleep)?

There is no native sleep or pause function in CFML. But with CFMX you can easily leverage Java and take advantage of Java's sleep function. The following code snippet will sleep for 1,000 milliseconds (one second) between calls to getTickCount().

<cfoutput>
Before Sleep: #getTickCount()#<br>
<cfscript>
  go_to = createObject("java", "java.lang.Thread");
  go_to.sleep(1000); //sleep time in milliseconds
</cfscript>
After Sleep: #getTickCount()#
</cfoutput>

This question was written by Steve Gustafson
It was last updated on February 22, 2006.

Categories

Miscellaneous

Comments

comments powered by Disqus