Re: Cleaning up my messy code

From: Date: Mon, 29 Sep 2003 19:52:36 +0000
Subject: Re: Cleaning up my messy code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-164294@lists.php.net to get a copy of this message
You should search the web for articles on MVC, Model View Controller. This is a standard technique for separating your presentation from your logic from your database. The concept can be applied to any programming or scripting language since it actually falls under the much bigger realm of design patterns. I would highly recommend reading at least one or two articles on MVC, you don't have to completely understand it, but it will give you a could foundation. After that, there were a few articles written on using MVC specific to PHP over at phparch.com. I subscribed to that magazine a few months ago and I think it's well worth it. You may need to subscribe yourself to see the past articles, but it's not expensive for the PDF subscription version. I looked into the templating systems at first, but really wanted to try what they were doing myself. It ends up being very easy to implement using output buffering. Just look into the ob_start() command. Here is an example of how I load a template file into a variable: ob_start(); include("templateFile.tpl"); $tpl_content = ob_get_contents(); ob_end_clean(); On Monday, September 29, 2003, at 03:22 PM, Chris wrote:
I am working on a fairly large scale (for myself anyway) project using PHP and MySQL. I am victim of teaching myself to program, not separating presentation from my code-- all the things that lead to masses of spaghetti code so atrocious even I can't figure out what I was doing an hour ago. I'm not looking for an IDE or code generator so much as some practical advice for organization and framework when developing a larger app. I know of PHP Fusebox, having programmed with Cold Fusion fusebox for a while, but it seems like that might be too much. Maybe I just need a sensical, practical approach to application layout. What do you all do? How can I learn to be a better PHP programmer in this regard? -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577


« previous php.general (#164294) next »