Re: Re: echo/printing html within a function - best method
| From: | Rasmus Lerdorf | Date: | Mon, 17 Sep 2001 04:32:12 +0000 |
| Subject: | Re: Re: echo/printing html within a function - best method | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67564@lists.php.net to get a copy of this message | ||
> > > How do you echo your html, do you put the html in your functions and
> > > escape the double quotes? There is some extra load there echoing all the
> > > html?
> >
> > echo HTML? I do this:
> >
> > <? php stuff..?>
> > HTML stuff
> > <? more php stuff ?>
> >
> > I drop out of PHP mode to display raw HTML. If I have a lot of HTML with
> > a lot of PHP variables tossed in, I do:
> >
> > <?
> > $test = 'test';
> > $one = 'one';
> > echo <<<EOF
> > This is a $test.
> > And here is another $one.
> > EOF;
> > ..more php code...
> > ?>
>
> I meant to say, in your functions, do you use the same as above echo <<<EOF ...
I try to avoid having my functions generate HTML. But yes, when they do I
use the same approach. You can have functions that look like this:
<? function foo() {?>
HTML Stuff
<? } ?>
That is, a function that does nothing but output HTML.
-Rasmus