Skip to main content
Inspiring
December 11, 2008
Question

PHP to CF Conversion

  • December 11, 2008
  • 4 replies
  • 442 views
I asked in a JS forum how to delay a browser closing for a couple seconds and someone came back with the solution, however they supplied one of the pieces in PHP to which I know nothing about.

I know CF has no sleep function, but would like to see how much of this can be converted into a cfm page. I can try to think of a way to delay the end.

Here is their snippet:

<?php
$secs = (isset($_GET["t"]) && is_numeric($_GET["t"])) ? $_GET["t"] : 5;
sleep($secs);
echo("ready");
?>

Would something like:
<cfscript>
seconds = url.seconds;
**Something like a loop that runs for 5 seconds**
return done;
</script>
This topic has been closed for replies.

4 replies

December 12, 2008
at least a couple of ways to do this:

1. sleep the java thread:
http://tech.groups.yahoo.com/group/coldfusion-howto/message/38270

2. use the CF_SLEEP custom tag (google it)
Inspiring
December 12, 2008
projectproofing wrote:
> I asked in a JS forum how to delay a browser closing for a couple seconds and
> someone came back with the solution, however they supplied one of the pieces in
> PHP to which I know nothing about.
>
> I know CF has no sleep function, but would like to see how much of this can be
> converted into a cfm page. I can try to think of a way to delay the end.

http://www.petefreitag.com/item/85.cfm

--
Mack
wkolczAuthor
Inspiring
December 11, 2008
Thanks but it has to be a programming language. JS is calling out to it to create a delay in the page closing so Flex has time to send out a webservice request.
Inspiring
December 11, 2008
Hi,

Here is the JS code,

<script language="javascript">
setTimeout('self.close();',5000);
</script>