Code Comments
Programming Forum and web based access to our favorite programming groups.this may be a real silly question is there a way to detirmine the lenth of a resulting html page while the page is still in the output buffer before sending it to the brouser ?? thanks
Post Follow-up to this messageNo. The length of the resulting page is determined by the resolution on the client's PC. As the browser window is resized so is the text within it, so as the window becomes narrower it also becomes longer. The whole point of HTML is that the client decides on the page size, not you. -- Tony Marston http://www.tonymarston.net "chris" <someone@here.com> wrote in message news:41cfbea0$1@funnel.arach.net.au... > this may be a real silly question > > is there a way to detirmine the lenth of a resulting html page while the > page is still in the output buffer before sending it to the brouser ?? > > thanks > > >
Post Follow-up to this messageTony Marston wrote: > No. The length of the resulting page is determined by the resolution > on the client's PC. As the browser window is resized so is the text > within it, so as the window becomes narrower it also becomes longer. > The whole point of HTML is that the client decides on the page size, > not you. And also the fonts and size preferences of the browser also cause the page to be longer or shorter. When I read your question I thought you might also mean the size (in bytes) of the page, as opposed to the "length" (ie how long the page is). You can do this with PHP using the output buffering functions. If this is what you were meaning then take a look at the following manual page which has an example of how to do this: http://www.php.net/manual/en/function.ob-get-length.php -- Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Post Follow-up to this messageWith the help of style sheets and fixed text area width you can achieve 95% visitors will see your page the same way. If you'll use fixed width font, you can determine where the lines will break. So, generally, it is possible, but very limited in possibilities.
Post Follow-up to this messageob_start();
// Put what you want to output
$my_page = ob_get_contents();
ob_end_clean();
$my_page_size = strlen($my_page);
header("Content-length:$my_page_size");
echo $my_page;
I think its what you're searching ..
++Drill
Post Follow-up to this messageob_start();
// Put what you want to output
$my_page = ob_get_contents();
ob_end_clean();
$my_page_size = strlen($my_page);
header("Content-length:$my_page_size");
echo $my_page;
I think its what you're searching ..
++Drill
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.