See course schedule for due date.
project2
.project2.zip
and submit it via Canvas.You will use PHP to automatically to implement your website so that common structures are generated programmaticially. You will use
While you must follow the requirements below, you can implement your common structures and programmatic generation however you choose.
The following references are helpful. Please use them.
# | Description | Points |
---|---|---|
1 |
Use PHP function(s) (one or more) to generate the required HTML structure of all your pages.
Hint:
Using the code from Lab 6 will help satisfies this requirement, but splitting the
make_page function
into separate functions for creating the top structure (html, meta, title, links, etc) and bottom structure (javascript links, closing body, etc)
will get you maximum/full credit. Then, make_page can call these functions which will make it a much simplier function.
Then, you can use the new functions to more easily create custom pages (see below).
|
30 |
2 |
Use PHP arrays and foreach loops (two or more times) to generate repeating structures rather than duplicate identically structured code.
Hint:
Your courses web page is a perfect page to generate programmatically. Rather than generate this page using the
make_page function,
create a new function called make_courses . Then, course.php would call the make_courses function, not make_page ,
and generate the structure automatically as shown in class on Friday.
Also, consider how helpful it would be if you had separate functions for making the top and bottom structure of a web pages (see first requirement).
Thus, make_courses would use these functions rather than duplicate the top and bottom web page structure.
|
25 |
3 |
Use PHP variables to store values that are common to all pages.
Hint:
Consider that the website name, the page name, the author and copyright appear on many pages and many places. Rather than bury this content in an echo statement or a hard-coded string,
define the values as global variables in
functions.php and use the variable instead of the value.
|
15 |
4 |
Create a PHP function that can create a common component using parameters such that the structure never needs to be duplicated, but different unique content can be passed via parameters.
Hint:
Instead of hard-coding the HTML code for a Bootstrap component such as a Card, Button or List Group, consider making a function that creates the HTML structure where you can pass values such
as the title, content or color style (primary, success, dangers, etc)
as function arguments. For example, your homepage might have two or more Bootstrap Cards. Rather than generate your homepage, using the
make_page function,
you could create a custom function called make_homepage that creates this page with two or more Bootstrap Cards by calling a make_card($title, $content, $color) two
or more times with different values.
|
20 |
5 |
Use an if statement in at least one function such that the structure of the web page depends on a value.
Hint: Using the code from lab6 satisfies this requirement.
make_page can have 1-3 columns of content depending on whether or not a side menu
or aside content is passed.
|
10 |
Make sure all your files (html, css and images) are in one folder called project2
.
Create a zip file of this folder and submit via Canvas.
This project is individual. You should not share your html or css code with anyone in the class. While it may be natural for your resumes to have similar structure and styles, excessive similarity (especially in source code formatting) is a sign that you used someone else's files but changed the content. When you do this, you learn less about the syntax and rules of HTML and CSS. You are expected to author all your files from scratch and protect them so that no one can copy your hard work.