|
Posted by Toby A Inkster on 11/11/45 12:00
Mike Placentra II wrote:
> There's no advantage to processing in the middle of the output. It makes
> more sense not to separate your code into header and processing blocks.
> All processing should usually be done before any output so you don't end
> up with spaghetti code.
My general technique nowadays is not to distinguish so much between
processing and output. My PHP builds up a large object, representing the
page, and at the end, I just run:
print $page->toHTML;
or somesuch. Only one print statement for the entire PHP script, and no
HTML outside the <?php ... ?> block.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 17 days, 23:00.]
Gnocchi all'Amatriciana al Forno
http://tobyinkster.co.uk/blog/2008/01/15/gnocchi-allamatriciana/
Navigation:
[Reply to this message]
|