|
Posted by Jerry Stuckle on 12/14/06 21:04
Tim Streater wrote:
> In article <bIegh.1422$lc1.1288@fe56.usenetserver.com>,
> Double Echo <doubleecho@your.com> wrote:
>
>
>>Bill,
>>
>>Sorry for not getting back sooner... had a lot of work interrupting my
>>newsgroup time. :-)
>>
>>Here-doc allows you to basically print out whatever is between the pattern
>>you choose.
>>
>>I use ENDOFHTML but you could use ENDOFCODE or whatever.
>>
>>Perl has a similar construct:
>>
>>print <<ENDOFHTML;
>>ENDOFHTML
>>
>>Notice the semi-colon at the top, PHP is a bit more "correct" putting the
>>semi-colon at
>>the end:
>>
>>print <<<ENDOFHTML
>>ENDOFHTML;
>>
>>PHP also uses "<<<" whereas Perl uses "<<".
>>
>>Anyway, embedded PHP programs were the rave a couple of years ago, and people
>>were doing
>>it trying to create really dynamic pages, but it's really messy as you've
>>found out to
>>do it that way.
>>
>>It's easier to print <<<EDNDOFHTML because you can actually use ' and "
>>in the block without trouble. There are also a lot of web servers that don't
>>like embedded
>>PHP in HTML docs and will barf or ignore it if you attempt it. So, it's
>>better to embed HTML in PHP,
>>and save yourself the hassle.
>
>
> No, I've gone away from this approach and had no problems at all. My
> pages embed the PHP in the HTML. Its a lot easier that way. I use PHP to
> dynamically generate the html based on what is in our mysql database.
>
> -- tim
Hi, Tim,
I agree with you. And I find this style, even when written by someone
else, to be much easier to follow than echoing everything from PHP.
But it's a matter of programming style. Some like it, some don't.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|