Coding Style Question...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am relatively new to PHP... I have about 1.5 years of light PHP work under
my belt... Over the past year or so my PHP coding style has evolved
significantly and I'm curious as to how experienced programmers write PHP...

Basically, here is what I have evolved to:

1) ALL php code is at the top of the file.
2) ALL html code is in a here document at the bottom.
3) php code is run before 1 character is outputed (and hence, no headers are
sent, leaving redirects open for possibilities)
4) I almost always following my require_once directives with a
session_start() at the top of the file.
5) Often, my forms submit to the PHP page that generated them but do so with
a hidden posted variable. If that variable is set, then I process the form
submission.

I think the most important part of all this is #1 & #2... I think I am using
PHP a little like template engine this way...

It seems to me that I most often see code snippets that try to intertwine
HTML and PHP, but in my experience, except for trivial examples, this
doesn't work so good...

What do you think?

--
Publish technical articles @ skilledwords.com and get 100% of the
ad-revenue!
http://www.skilledwords.com

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux