|
Posted by Jerry Stuckle on 12/14/06 21:09
Double Echo wrote:
> 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
>
>
>
> It might be easier for _you_, but not for the next poor bastard that
> will have
> to agonize at the shitmess you made.
>
I disagree. I like this style also, and find this style to be much
easier to troubleshoot and modify than echoing everything from PHP.
> There is no excuse for shitty-looking code. Another annoyance for me
> are people
> who have to roll-up their brackets as if there is a line penalty for
> good, structured
> code. Like you're going to run out of lines or air or something.
>
Agreed. And personally, I think your style looks pretty shitty. But
it's only my opinion, and it's a matter of what you're used to.
> People who like to
> if (...) {
> }
>
> or
>
> while(...) {
> }
>
> annoy the fuck-out-of-me because I have to stop, read really slowly and
> try to grasp
> the nesting, and logic. It's all rolled up so you can't hardly separate
> the code into
> something readable.
>
And I find hundreds of unnecessary echo statements to be unnecessarily
ugly and complicating.
> It's so much cleaner to
>
> if ( ... )
> {
> code here
> }
>
> or
> while( ... )
> {
> code here
> }
>
Sure. But when you add dozens of echo statements in your braces, it
gets a lot more complicated. And when you start concatenating strings
together to get variables and html... terrible!
> but all the goddam schools preach shitmess roll-up coding and OO. It
> works but it's so fucking
> messy. You fucking kids think it's cool code, and wow, neato, but then
> somebody else has to
> work on it, and it's a fucking nightmare. Clean code, nested, and
> properly written will allow
> the code to be debugged better, and probably survive being re-written
> all over again because you
> can actually read it. I've gone on to delete code I can't read and just
> re-wrote it cleanly.
>
> -DE- ( using my best Dr. House imitation )
>
>
Well, if "all the goddam schools" teach it, there must be something to
it, don't you think?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|