Advice on my OOP CMS please - your thoughts?

Hi All,

Looking for some help if possible. I’m in the process of moving over from procedural code to an OO approach and have decided that a good way of learning OOP in PHP would be to try and create a CMS i’ve built with OOP for a business directory.

Now i’m sure there are probably lots of people that will come on and say I’m wasting my time, use a CMS MVC Framework that’s already built using OOP, and in the future I probably will. But for now my goal is to get familiar with OOP and I feel writing my own CMS in OOP i’ll be able to learn a lot more about OOP which will help me in future projects.

So first thing i’ve thought about is:

What does my existing procedural CMS contain
-DB Connection
-Lots of INSERT, SELECT, UPDTATE, DELETE queries
-30 odd forms that do select & update queries
-Form validation
-Sanitization
-Basic include functions ie
-HTML layout & tables

Now, going from this I was thinking of creating the following classes in the CMS:

1. Class Database
A collection of attributes and methods that allow my pages in the CMS to dynamically:
-Open a connection
-Run a Query
-Insert data into MySql
-Update data in MySql
-Remove data in MySql
-Close a connection

2. Class Form
A collection of attributes and methods that allow my pages in the CMS to dynamically create a web form which:
-Set a method ie $_POST
-Set an action
-Set a name
-Set a legend
-Set a label;
-Set a input type
-Set a input_name
-Set a input_value
-Set a input_class

3. Class Sanitize_Validator
A collection of attributes and methods that allow my pages to run try-catch methods on my form data to check the data on a form:
-Is int – (then sanitize)
-Email validates correctly
-Filter Var
-is Object
-Is string – (then sanitize)

4. Page
A collection of attributes and methods that allow the dynamic creation of html pages on my site:
-Set page title
-Set page Keywords
-Set Page Description
-Set opening <h1> tag
-Set some body_text

Now, my questions are as follows if anyone would be so kind:

  1. Does this structure look OK? Can you see anything missing that you would normally see in a CMS that I could write a class for?
  2. I’ve learnt about inheritance, but looking at my structure above I don’t think I could use it as there is nothing there I could use a ‘is a’ for? Can anyone think of anything?
  3. Is it worth trying to put this into a MVC structure straight away, or should I just get familiar with OOP first?
  4. Any other OOP methods I could use in my CMS as i’m keen to use as many as possible in this project to learn as much as possible, for example any Abstract Classes, Interfaces, any cloning that could be useful you can think of in a CMS

Any suggestions anyone can offer on what i’ve got planned would be great.

Thanks