Re: PHP and HTML
| From: | Andy Woolley | Date: | Wed, 28 Jun 2000 16:10:01 +0000 |
| Subject: | Re: PHP and HTML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3593@lists.php.net to get a copy of this message | ||
As I say, there are no hard and fast rules but it's better standardise like
this:
Open PHP tags, then you can open include files, set up variables, perform a
few calculations etc etc.... close the PHP tags and then output your HTML.
If you need PHP to populate an OPTION box from a table for instance further
down the page, put all code within one set of PHP tags (using echo to output
HTML as needed, once inside PHP tags using echo is more efficient than '<?
echo "something"; ?>') and then go back to HTML. It's none efficient to for
example; open PHP tags to query the table, close them and set up the OPTION
(<SELECT>) box, open them again to loop through the results and then close
them to finish the OPTION (</SELECT>).
Echo is a function and all functions will use processing power although I
don't you would notice the difference on small pages.
Hope this email is not too ridiculous.
Andy
----- Original Message -----
From: "Sam Masiello" <smasiello@chekinc.com>
To: "Andy Woolley" <andy@milonic.com>; "Steven Reed"
<steven@domino.com>;
<php-general@lists.php.net>
Sent: Wednesday, June 28, 2000 4:53 PM
Subject: RE: [PHP] PHP and HTML
>
> I think the primary question that results from that is:
>
> What is the break even point between more opening/closing PHP tags, and
the
> overhead supplied by using echo statements and less opening/closing PHP
> tags. At what point is one more beneficial than the other?
>
> Has anyone ever done any solid analysis on this? I would be interested in
> the results.
>
> Sam Masiello
> System Analyst
> Chek.Com
> (716) 853-1362 x289
> smasiello@chekinc.com
>
> -----Original Message-----
> From: Andy Woolley [mailto:andy@milonic.com]
> Sent: Wednesday, June 28, 2000 11:46 AM
> To: Sam Masiello; Steven Reed; php-general@lists.php.net
> Subject: Re: [PHP] PHP and HTML
>
> There will always be a slight overhead with echo. best to use as few
> opening/closing PHP tags as possible. Bunch all HTML together and try to
do
> as much PHP as you can in one go, this applies to ASP code as well. There
> are of course no hard and fast rules but it just depends on what you are
> trying to achive.
>
> Sometimes you can't help mixing and matching but dont use echo just
because
> it's there. Good code comes from a little brain power so designing when
and
> where to use PHP to output HTML should have some thought.
>
> Andy.
>
>
> ----- Original Message -----
> From: "Sam Masiello" <smasiello@chekinc.com>
> To: "Steven Reed" <steven@domino.com>; <php-general@lists.php.net>
> Sent: Wednesday, June 28, 2000 4:39 PM
> Subject: RE: [PHP] PHP and HTML
>
>
> >
> > I think this is more of a personal preference issue than anything else.
> > Personally I prefer not using echo statements to output regular HTML, if
> > anything because I think it is easier to read that way.....there might
be
> a
> > performance issue with this question as well, but I do not know that for
> > sure.
> >
> > Sam Masiello
> > System Analyst
> > Chek.Com
> > (716) 853-1362 x289
> > smasiello@chekinc.com
> >
> > -----Original Message-----
> > From: Steven Reed [mailto:steven@domino.com]
> > Sent: Wednesday, June 28, 2000 11:37 AM
> > To: php-general@lists.php.net
> > Subject: [PHP] PHP and HTML
> >
> > Hello All,
> >
> > I am new to PHP, i was wondering which method is best for displaying
HTML
> on
> > PHP pages, efficiently.
> > Is it to embed the HTML statements inside of Echo statements, or to
close
> > the PHP tags and then have normal HTML ?
> >
> > Thanks in advance - Steven.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>