Jump to content

Pause the script...but not stop it completly


spaceace

Recommended Posts

Hi,

 

Consider the following script;

 

<?

echo 'Hello ';

sleep(1);

echo 'world!';

?>

 

Is it possible to have php process the script so that the web page instantly displays Hello, then pauses for 1 second and then displays world!, instead of what is actually happening which is a 1 second pause followed by Hello world!

 

TIA

Jason

 

Link to comment
Share on other sites

put them in two different tags?

 

<?php

// <?php is more versatile than just <? by the way...

 

echo 'Hello';

sleep(1);

?>

 

<?php

echo 'World';

?>

 

but just so you know... neither works for me at all... I'd be more tempted to use Java script for something like this due to the way it handles updating display settings. It's not really something that a server does particularly well. it's much better for the local machine to do it because of different download speeds. Especially if the delay's only 1 second long.

Link to comment
Share on other sites

is that not a document effect? If so it's something that should be controlled by javascript.

<?php
echo 'Hello ';
echo '<span id="delay"></span><noscript>world!</noscript>';
?>

 

javascript

 

function triggerCont()

{

setTimeOut(delayText,1000);

}

 

function delayText()

{

el = document.getElementById('delay');

el.innerHTML = 'world!';

}

 

then put the onload="triggerCont();" attribute in you body tag.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.