|
-
Jul 6th, 2009, 09:14 AM
#1
Thread Starter
Addicted Member
loading a (whole) php webpage
Is there any code that would load the whole of a page and then show it, instead of a browser showing what it can whilst it loads?
-
Jul 6th, 2009, 09:54 AM
#2
Re: loading a (whole) php webpage
Output buffering?
Start your page(s) off with:
Code:
<?php
ob_start();
?>
...and end them with...
Code:
<?php
ob_end_flush();
?>
I don't think you even really need ob_end_flush() at the end - the output buffer automatically flushes itself when it gets to the end of the page (if you haven't told it to do otherwise).
-
Jul 6th, 2009, 10:10 PM
#3
Re: loading a (whole) php webpage
Unless the script in question takes an abnormally long time to run, output buffering is not the solution to the problem described. The browser is in fact waiting for the script output to be transmitted, not for the server to process the script. There is no way you can control this from the server side.
There are two primary cases in which output buffering is useful:
1. The script takes a long time to run by design. Manually flushing the buffer regularly will ensure that the latest output is being shown to the user, rather than being stored in the server-side buffer.
2. You wish to post-process the output before sending it to the client. Perhaps your script produces some sort of intermediate output (like XML) which you then transform into a client-consumable format such as HTML or XHTML.
-
Jul 9th, 2009, 08:02 AM
#4
Thread Starter
Addicted Member
Re: loading a (whole) php webpage
Ok thanks,
I'll have a look at using something other than Php
-
Jul 9th, 2009, 09:49 AM
#5
Re: loading a (whole) php webpage
Thanks penagate - just curious, any thoughts how you'd go about doing this? If it has to be done client-side, are CSS and Javascript the only methods available?
What comes to mind for me is to put an overlay div over the entire page:
Code:
<div style="position:absolute;top:0;left:0;width:100%;height:100%; background:#fff;z-index:2;"></div>
...and then get rid of it with Javascript when the page is loaded. But this would be horrible for the user if they have Javascript turned off... But if any solution is going to require Javascript anyway...
-
Jul 9th, 2009, 07:33 PM
#6
Re: loading a (whole) php webpage
Flash or JavaScript are the two methods which come to mind. Both inelegant.
If using JavaScript, you could perhaps use a style rule set in a noscript block to ensure the overlay is hidden when JS is not available.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|