| Author |
determine lenth of page
|
|
|
| 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
| |
| Tony Marston 2004-12-27, 8:55 am |
| 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.
--
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
>
>
>
| |
| Chris Hope 2004-12-27, 8:55 am |
| Tony Marston wrote:
[color=darkred]
> 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/
| |
|
| With 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.
| |
|
| ob_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
| |
|
| ob_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
|
|
|
|