Re: Outputting HTML with PHP - Buffer Problem?
| From: | Jason Davidson | Date: | Sun, 12 Sep 2004 16:33:54 +0000 |
| Subject: | Re: Outputting HTML with PHP - Buffer Problem? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196444@lists.php.net to get a copy of this message | ||
There is nothing wrong with what your doing, i use this sort of thing
for all the big sites i make, i use a page class and use methods to
create the header and footer, so your concept is good. I would
investigate your html_head() function, to make sure its actually
returning something. Sinse your 'print'ing it, it must return some
text.....
example
function html_head() {
$html = "<html....................................";
return $html;
}
i prefer to escape from php inside my header fucntion, and just not
print it..
eg.
function header() {
<?
<html
<head
<title........
?>
}
then i call it with $page->header();
hope that helps....?
Jason
Nick Wilson <nick@stylesheet.org> wrote:
>
> Hi all,
>
> Say i have a php script like this:
>
> <?php
> print(html_head());
> // do loads of time taking stuff
> print(html_footer());
> ?>
>
> How come I dont see the html header (it's just a function that returns a
> string with the html up till <body>) before the entire script has run?
>
> This goes against my understanding, why might this be and what might i
> use to get some output before the script has finished executing?
>
> Much thanks...
> --
> Nick W
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>