Final: The Organization and Planning Process
Brief
The planning document for the Final Project requirements of CIT336.
Final: The Organization and Planning Document
Problem:
- Need a database oriented page/post delivery system
- Need a database oriented commenting system for the pages/posts
Solution - Pages/Posts:
First we need to make sure that we have a"wire-frame" layout in which the pages can be displayed. The layout will be complete with a header, body and footer corresponding to design.
Then we need to create the database table to hold the content of the pages or posts that we will want to display to the visitors. This is what I came up with, although it may not be the best possible solution:

You may chose to make your 'slug' field unique so that you do not have any accidental repeat slugs resulting in missing pages, or accidentally pulling the wrong page intended. You will see why, below...
Now skipping the Content Manager, we will just assume for now we enter the posts into the database manually. Then all we need to do is call a select on the database and retrieve the appropriate page from the "wire-frame" page or layout. There are various ways to do this, but the method I actually implemented on this website is using object oriented php and some htaccess code, but for simplicity's sake, I will describe the easiest way to do this. This is using the $_GET global variable in php that is passed in via the URL. We will call it $_GET['p']s. Then in order to call the page that we want, we will use the "slug" that you can see in the database.
For example: For a page/post titled "How to Chop Down a Tree" We would enter into the slug field 'how-to-chop-down-a-tree' This will help search engines optimize your site, its content and the relevancy of the URL, because the url will be:
http://www.example.com/something.php?p=how-to-chop-down-a-tree
This will make the $_GET['p'] variable available and can use this in your mysql query to the database adding "WHERE `posts`.`slug` = '{$_GET['p']}'" (This is why you might want to make the database force your slugs to be unique).
Solution - Comments:
For the comments we will create the following table

Using the post_id and the user_id, we will plug in the relative id's of their corresponding table associations. For example if the how-to-chop-down-a-tree post has the id of 38 and the user commenting has an id of 15633 then the comment inserted in the table will have its own id, then post_id = 38 and user_id = 15633 when the data is entered in the table. This will all be done via php logic in the script that handles the comment form submission.
That brings us to the form, we will have a form displayed at the bottom of each post that is surrounded with a php if statement checking to see if the user is logged in. If they are: Show the form; if they are not: give them the option to login or register.
Login or Register to post a comment