Purpose and Learning Outcomes
The purpose of this assignment is to complete the construction of a new website by implementing server-side functionality using PHP.
This assignment is designed to address the learning outcome related to PHP:
Identify when it is appropriate to use server-side programming such as PHP and to write simple PHP code to perform some functionality for a web application.
Background
River Lawrence is very pleased with the site, especially the new recipe features. River has also nearly completed more recipes for the site, which will be added in the near future. However, the client has asked for one more feature: a comment system for the recipes so visitors can provide (hopefully) positive feedback.
User comments are typically stored in a database, which is queried on page load. However, querying a database is beyond the scope of this course. Instead, a PHP function is provided to mimic the results of such a query. This also provides an excellent reason to change the site’s existing pages from HTML files into PHP files.
Materials
• The skeleton of functions.php, which includes:
◦ the function get_user_comments_from_db() which returns the result of a “database query” for the user comments
• An appearance and behaviour package (2.6MB) with:
◦ videos that demonstrate the appearance and functionality of the comment form and
◦ a PDF with information about spacing for the elements.
Requirements for Switching from HTML to PHP
Files
All of the existing .html files must be changed to .php
head Element
• You must write a function print_head(…) in functions.php with two parameters:
◦ one for the page’s title; and
◦ one for a (possibly empty) array of src paths to JS files to include via