note 87292 deleted from function.main by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Jun 2009 18:35:59 +0000 |
| Subject: | note 87292 deleted from function.main by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157007@lists.php.net to get a copy of this message | ||
Note Submitter: yves dot vanhal at hogent dot be
----
In an effort to separate PHP code as much as possible from the HTML code I use the following
self-enforced standard:
* all PHP functions are above the <!DOCTYPE> or <HTML>
* the last function in the list in the PHP block is a function called main()
* within the <BODY> element the first thing I do to initialize the page is to make a call to
the main function
This results in code looking like this:
<?php
function xxx() { }
function yyy() { }
function main() {
xxx() // execute call to other function
}
?>
<HTML>
<BODY>
<?php main() ?>
</BODY>
</HTML>
This way I hope my code will be readable for newbies and advanced programmers.