Re: PHP and HTML
| From: | Alex Black | Date: | Thu, 29 Jun 2000 01:28:10 +0000 |
| Subject: | Re: PHP and HTML | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3704@lists.php.net to get a copy of this message | ||
I think it is much more of a style / working efficiency issue than
performance.
90% of the motivation behind core_template for binarycloud was to separate
php logic and presentation markup (html, wml, whatever)... which is entirely
realistic and doable.
I don't know why anyone would want to echo anything to do with html in a
production system... you might as well use perl. The point about php is that
you can easily integrate logic with markup, but I think people went crazy.
Just because you _can_ embed all of your db queries in the html just before
need to print them doesn't mean it's a clear way to write code :)
We built core_template with all that in mind, and if you look at even the
overly simplistic example code on binarycloud.com, you'll see that in a
team-development environment it will save you days & days.
yeah, and since when is
<html>
<font face="verdana"><?=$variable?></font>
</html>
harder than
print "
<html>
<font face='verdana'>$variable</font>
</html>
";
given that the latter method will also wreak havoc on anyone trying to write
javascript with php-generated elements keyed in:
onmouseover="dotext('<?=$msg?>');"
(note the necessary use of _both_ types of quote)
_a
--
Alex Black, Head Monkey
enigma@turingstudio.com
The Turing Studio, Inc.
http://www.turingstudio.com
vox+510.666.0074
fax+510.666.0093
Saul Zaentz Film Center
2600 Tenth St Suite 433
Berkeley, CA 94710-2522
> From: dave@thedatasource.net ("David A. Snodgrass")
> Newsgroups: php.general
> Date: 28 Jun 2000 09:57:54 -0700
> Subject: Re: [PHP] PHP and HTML
>
> I agree. I think that performance issues are very insignifigant.
> If you are grasping for every little microsecond,
>
> <taco bell dog>
> I theenk i need a beeger box
> (maybe 2 :)
> </taco bell dog>
>
>
> I quite often do print tags, in areas im pussling a lot of variables, say a
> mysql while loop, i dont wanna break in and out of php, over and over, so i
> do a print like this:
>
> print "
>
> htmlcode $variable $variable2 $variable3
> htmlcodehtmlcodehtmlcodehtmlcodehtmlcodehtmlcode
> $variable5 $variable6 htmlcodehtmlcodehtmlcode
>
> ";
>
>
> (One print statement for multiple lines.)
>
> Also, keep in mind you CAN use ' in your html as opposed to " so you dont
> have to escape it all :)
> (i.e. print "<font face='$font1' size='2'
> color='#FFFFFF'>";
>
> as opposed to:
>
> (i.e. print "<font face=\"$font1\" size=\"2\"
> color=\"#FFFFFF\">";
>
>
> - dave
>
>
>
>
> ----- Original Message -----
> From: "Jason" <jasonc@webpipe.net>
> To: <php-general@lists.php.net>
> Sent: Wednesday, June 28, 2000 8:33 AM
> Subject: RE: [PHP] PHP and HTML
>
>
>> Even though it might be a bit faster to break in and out of PHP to output
>> straight HTML, I look at two things. Is it faster to write and read? The
>> speed advantages won't be huge so unless you're grasping for every last
>> microsecond, I wouldn't worry about it. Generally if I need to output a
>> huge block of HTML in a loop for instance, I'll break out of php to type
> the
>> html and then break back in. Alot faster than typing a million echo
>> statements. If I wanted that, I'd write servelts and their blasted
> println
>> statements....
>>
>> Jason
>>
>>> -----Original Message-----
>>> From: Billy Harvey [mailto:Billy.Harvey@RhinoComputing.com]
>>> Sent: Wednesday, June 28, 2000 10:18 AM
>>> To: php-general@lists.php.net
>>> Subject: RE: [PHP] PHP and HTML
>>>
>>>
>>>> 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
>>>
>>> Sam,
>>>
>>> I think it would difficult to assess a meaningful number. Even
>>> looking at just the Unix world alone at first, you'd have to compare
>>> several possibilities, such as php as a cgi, or php as an Apache
>>> module (and Apache is not the only server of course). The variant of
>>> Apache you used might have a significant effect because of its
>>> interfacing. The version of php you used might be significant. The
>>> load on the system would definitely matter. Even isolating the system
>>> for just such a test would give rather meaningless results I believe,
>>> as few systems are going to be serving the same page continuously, and
>>> as php is best used in an environment where the customer is making a
>>> dynamic selection, often with multiple lookups on databases.
>>>
>>> I guess the whole point of the above is that unless echo is *terribly*
>>> inefficient (and outputting a string is about the simplest thing an
>>> interpreter can do), then the ease of use factor would be more
>>> important.
>>>
>>> Most people here seem to like jumping in and out of php all the time.
>>> I'm not in that camp, and prefer to enter php at the beginning and
>>> leave it at the end. That way I know everything in between is php
>>> either calculating, fetching, or outputting. It helps me keep things
>>> straight.
>>>
>>> Heck, I even hate having to output Javascript - I want a browser
>>> module that can read php at the receiving end - but that's another
>>> subject.
>>>
>>> Billy
>>>
>>> --
>>> 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
>>>
>>>
>>
>>
>> _______________________________________________________
>> Site Design, Hosting, and E-Commerce at www.webpipe.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
>