The resources at W3Schools, where you can learn the basics of nearly all web design are excellent. It has an inbuilt editor where you can modify example code and see the effect immediately.
Read that section and click on the examples (takes 5 to 10 minutes).
- Create a direct instance of an object.
- Create a template for an object.
In the last example modify the code in the left window to: (Modifications in bold)
document.write(myFather.firstname + " is " + myFather.age + " years old.")
and click the button "Edit the text and click me".
Note the difference.
Write a function that changes the persons age, set the new age to 60 and submit the change.
Now you have a vague idea of OOP.
4. Next step.
Download free the first three chapters of the book "The PHP Antohology: Object Oriented PHP Solutions , Volume 1." by Harry Fuecks from SitePoint.
Chapter 2. Object Oriented PHP explains how you may make your own page object. Then you can add the properties and layout you want to that object and make your own page templates, eg. a table with three tables for header, body and footer with different properties etc.
Once you understand OOP, you will love it.
Also start your first step on Extreme Programming XP, by writing the tests of your code before anything else:
Exapmle: Again we use the resources at W3schools:
Use the code in "The onerror event" example to write a test to test for JS errors on the page.
Copy this code:
txt="There was an error on this page.\n\n"
txt+="Error: " + msg + "\n"
txt+="URL: " + url + "\n"
txt+="Line: " + l + "\n\n"
txt+="Click OK to continue.\n\n"
alert("JS code is OK!")
in the head section and this code in the body section before your own code:
Write this code in the body section:
<input type="button" value="View message" onclick="message()" />
You may improve the test by using JS Try...Catch and Throw statements.
5. An introduction to OOP PHP and MySQL.
From SitePoint you can also download free the first four chapters of the book: "Build Your Own Database Driven Website Using PHP and MySQL" by Kevin Yank.
Learning this technique you can buld you own content management system, and refactoring and you get full control over refactoring and updating.
Some useful links:
Code is Queen, refactoring is King.
Recommended book: "The Design and Evolution of C++" by Bjarne Strostrup. ISBN 0-201-54330-3
That book takes to a new level in OOP.