Hello,
Fist, as Chris Weimer recommended, you should upgrade to PHP 5 (PHP 5.0.5 just came out a few days ago) to make sure you have all the new features. A tool I always use when building OOP PHP projects is Smarty (
http://smarty.php.net/). Smarty is a template engine and the installation is described on their web page.
The approach I use for OOP PHP projects is build upon the MVC pattern. MVC stands for Model-View-Controller. The aim is to separate the different parts of a program from each other. The model is the heart of the application. In our approach it is the set of PHP classes you have in your project. The controller represents the user's interface to the model while the view presents the data from the model. Because in a web application the controller and the view are both presented in the web browser they are put together in a single layer, the so called template files. This is what you use a template engine like Smarty for. In web application you need an additional layer you don't have in the original MVC pattern. It's called the infrastructure. The infrastructure has two purposes. First it is the URL you type in your browser. You can't use the model (the PHP classes) and the templates for that. An infrastructe file is just a regular PHP file. Maybe it's easier to understand that with a simple example:
Imagine you want to create a contact form. You would probably have a file called contact.php. That's your infrastructe file. The first thing to do here is to check for any parameters ($_GET[], $_POST[], and so on). According to the parameters you probably have to deliver some information to the model (for example the user submitted a form). You do that by creating one or more objects of your classes and call the appropriate methods. Now the model does all the business logic. In our form it will probably validate the input data, store the data in a database, and so on. At the end the model delivers a return value, for example if the data was stored correctly or not. Now you create Smarty object in the infrastructure file:
Code:
// Include the Smarty class
require_once("Smarty.class.php");
// Create Smarty object
$smarty = new Smarty();
Depending on the return value(s), the infrastructure file decides which template file to use for the output and which variables the template file needs (which data should be displayed):
Code:
// Register the variable "foo" with the value "bar"
// You can use that variable in the template file
$smarty->assign("foo", "bar");
// Decide which template to use for output
$smarty->display("contact.tpl");
The Smarty syntax is described in the Smarty manual. You can download it on their website. In most cases you will register a return value from the model as a variable at the template. Maybe that sounds a bit complicated first, but it's quite easy if you get used to it.
That kind of approach has several advantages. Developers and designers can work independently on the project. The developers work at the model and the infrastructure and the designers at the template files. Developers won't even see a single line of HTML during the complete project while Designer won't see any PHP line. Developers can't destroy the layout and designers can't destroy the application. Due to that separation it's much easier to reuse components (classes) in other projects. You don't need to get rid of all the HTML crap before. It's also very easy to extend the project. Maybe you want to develope a WAP version of your application. All you have to do is to create a new set of template files. In the infrastructure files, depending on the source of the request, you have to decide which template (Web of WAP) to use and that's it. And of course, the maintenance of the whole application is also easier, because you don't have all the stuff in one file (HTML, CSS, JavaScript, PHP, and so on).
Unfortunately it's not possible to describe the MVC pattern and the MVC version for web projects in detail here, but maybe that gives you an idea where to start.
Good luck =),
Lars