Objective
The objective of this assignment is to use the techniques learned in class to create a PHP Blog using the Twig templating engine to create the page templates, a MySQL database for the data, and PHP and PDO to handle the logic.
This assignment will be completed and graded as a team (2 or 3 students). If you have not joined a team. Go to the People page and click on the “Group Project” tab. There will be a list of groups you can join.
Resources
Starter Kit
Attachment mtm6331-blog It will provide you will all the necessary files for completing the project. All these files can be found in the blog directory.
Use the included file to complete the requirements below.
To help you get started the following have already been done for you:
( The sql is already creating)
Blog Database
Here is a description of the tables and columns that can be found in the mtm6331-blog database.
There are two tables in the database, posts and categories. The relationship between the two is that each post can belong to ONE category, but a category can be found on multiple posts. This is relationship is maintained by the category_id column on the posts table.
Below is the column structure and description for each table:
posts
categories
Below are a few additional resources that maybe helpful:
Requirements
To successfully complete this assignment your must complete the following:
Create a Homepage
Use the index.php file and the list.html.twig template to create a homepage for your blog. The homepage will list the 5 most recent posts. Each post display the Title, Date, and excerpt. The Title should be a link to the post page.
(This is where I left on) I already create this part but you can have a look just in case)
Create a Posts Page
Use the post.php file and the post.html.twig template to create a post page for your blog. The post page will display content of the requested post and should include the Title, Date, Category Name, and Body. The Category Name should link to the category page. NOTE: The category name and slug are stored in the categories table.
The post page should also have an “Edit” button. When clicked this button should go to the edit.php file with the requested post data populated in the form.
Create a Category Page
Use the category.php file and the list.html.twig template to create a category page for your blog. The category page will list all the posts for the requested category. Each post display the Title, Date, and excerpt. The Title should be a link to the post page.
Create a Edit Page
Use the edit.php file and the form.html.twig template to create a edit page for your blog. The edit page will display the edit form with requested post data populated in the form.
The form should submit the data using the ‘post’ method and should include the following fields:
When the form is submitted, the form data should be used to update the post in the poststable, and redirect to the post’s post page.
Create an Add Page
Use the add.php file and the form.html.twig template to create a add page for your blog. The add page will display an empty edit form. When the form is submitted, the form data should be used to add a new posts to the posts table and redirect to the post’s post page.
Create Site Header
Use the config.php file and the base.html.twig template to create a site header. The site header should include a the site title, site navigation that includes a list of all the categories, and a search form.
The site navigation should be dynamically build pulling the list of the categories from the database.
The search form should submit to the search.php file and the data using the ‘get’method. There should be single text box for the search query.
Create a Search Page
Use the search.php file and the list.html.twig template to create a search page for your blog. The search page will list any the posts whose title, body, or excerpt contain the search query. Each post display the Title, Date, and excerpt. The Title should be a link to the post page.
Create an Error Page
Use the error.php file, .htaccess, and the error.html.twig template to create a error page for your blog. The error page should be used for when a post or page can not be found. The error page should have a link to take the user back to the homepage.
Update the TEAM.md File
Use the TEAM.md file to list the members of your team (Full Names) and the role that each team member played to help complete the project.
Bonus Requirements
The following task can be completed to for additional points.
Add a Stylesheet
Use style.css or create your own stylesheet to add CSS to the blog. The styles should make the blog more visually appealing, follows the best practices for responsive design, and is optimized for the multiple screen sizes and devices
Add Friendly URLs
Use the .htaccess file to convert all the of the site links and navigation to support friendly URLs.
Submission
you will zip up the entire blog directory with your completed project. The zip file should contain all the PHP, Twig, CSS and JavaScript files needed for the project. NOTE: It is NOT necessary to include a database or .sql file.
The grading of the assignment will the follow the rubric below. Each member of the team will receive the same grade, UNLESS it is determined that a member of the team did not do his/her fair share of the work. IMPORTANT! If any part of the project contains ANY Syntax Errors OR otherwise will not load you will receive 0 points for the entire project.
Rubric
PHP Blog Rubric
PHP Blog Rubric | |||||
Criteria | Ratings | Pts | |||
This criterion is linked to a Learning OutcomeHomepage
Use index.php to retrieve the 5 most recent posts from the database and use list.html.twig to display the Title, Date, and Excerpt for each post. The Title should link to the post page. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomePost Page: Retrieve Post Data
Use post.php to retrieve ALL the post data from the database including the category name for the desired post. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomePost Page: Display Post Data
Use the post.html.twig template to display the desired post’s Title, Date, Category Name, and Body. The category name should link to the category page. An edit button should be created and should link to the edit page. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeCategory Page
Use category.php to retrieve all the posts that match the desired category. Use list.html.twig to display the Title, Date, and Excerpt for each post. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeEdit Page: Display Populated Edit Form
Use edit.php to retrieve the desired post’s data from the database. Use the form.html.twig template, to display the edit form populated with the post’s data. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeEdit Page: Update Post
Use edit.php to update the post data with the form data and redirect back to the post page. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeAdd Page
Use the add.php and form.html.twig template to display a empty edit form. Use add.php to add a new post to the database and redirect to the post page for the new post. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeSite Header
Use config.php and base.html.twig to create site header that appears on every page of the site. The site header should contain the site title / logo, a site navigation containing links to all the category pages, and a search form. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeSearch Page
Use search.php to retrieve all the posts whose Title, Body, or Excerpt contains the search query. Use list.html.twig to display the Title, Date, and Excerpt for each post. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeError Page
Use error.php, the .htaccess file and the error.html.twig template to create a error page for when a Page or Post could not be found. |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeBONUS: Stylesheet
Create a stylesheet for the blog. The styles should make the blog more visually appealing, follows the best practices for responsive design, and is optimized for the multiple screen sizes and devices |
|
5.0 pts | |||
This criterion is linked to a Learning OutcomeBONUS: Friendly URLs
Use the .htaccess file to convert all the of the site links and navigation to support friendly URLs. |
|
5.0 pts | |||
Total Points: 60.0 |