showing something till it gets loaded...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psmshankar
Forum Commoner
Posts: 96
Joined: Tue Aug 06, 2002 4:25 am
Location: India

showing something till it gets loaded...

Post by psmshankar »

I'm using the DevText
( http://www.developershed.com/devtext.php )
in my home page.
Bcos of n/w unstability, my home page takes time to load as it connects to devshed to get the details..
How to by-pass this and flush all the other details - all the other contents are just html in my page - and then let that takes its own time to display..

till that time i shud show something in that area.. like 'Loading..'

any idea?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

flush()... but that only works on some servers...

alternately, you could place the devtext in an iframe...
psmshankar
Forum Commoner
Posts: 96
Joined: Tue Aug 06, 2002 4:25 am
Location: India

Post by psmshankar »

does iframe supported by all browser versions?
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

no.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mozilla/netscape/ie support it.. some other may, I don't quite know.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

when it comes to 'Please wait, loading....' I usually use this snippet:

Code: Select all

echo "<div id='loading_div' style='display:none'> Loading, please wait.... </div>";
echo <<<EOF
<script language="Javascript" type="text/javascript">
load_div = document.getElementById('loading_div');
content_div = document.getElementById('content_div');
content_div.style.display = 'none';
load_div.style.display = 'block';
</script>
EOF;
flush();
echo "<div id='content_div'>";
echo " CONTENT GOES HERE ";
echo " EVEN MORE CONTENT ";
echo "</div>";
echo <<<EOF
<script language="Javascript" type="text/javascript">
load_div.style.display = 'none';
content_div.style.display = 'block';
</script>
EOF;
flush();
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

[php_man]ob_start[/php_man]() and related functions might also be of interest.
Post Reply