This sounds a lot like this question.
I would strongly recommend that you take a look at Patterns of Enterprise Application Architecture by Martin Fowler.
I would also recommend that you search for questions on this site related to the Model or Domain as well as Object Relational Mapping or Database Abstraction. I happen to know that there is a great deal of excellent content particularly in regard to PHP.
I see two questions in this question that you've posted. First, what are the general architectural components of a site. Generally you'll have these three in some manifestation:
- Database and Database Interaction Layer
- Controller - handles $_GET and $_POST (the request) and assigning content to the View and ultimately rendering it.
- View - should contain only HTML and very basic code such as loops for iterating over collections and variable output.
Second question I see is where to place handling of a specific business object in the application. This is where the discussion gets a little more involved because I assume that you need to interact with Posts both as business objects (within the domain) and as rows in a database table. Both of these concerns can be wrapped inside of the same class utilizing a pattern called Active Record which has been popularized by Ruby on Rails. However, depending on the complexity of the application and database involved you may want to consider separating the business logic from the database interaction by creating one Post class that acts as the database interaction layer and another Post class that contains all of the business logic.