Skip to content

This exercise allows you to practice includes, conditional logic, comparison operators and control structures.

Notifications You must be signed in to change notification settings

bpd01001/php-website

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
www
 
 
 
 
 
 

PHP Website

This exercise allows you to practice includes, conditional logic, comparison operators and control structures.

(Real-World) Premise

You are taking a static website and converting it to PHP. This will allow you to easily add pages and navigation by simply modifying PHP variables, instead of doing a find/replace on every page of your website.

Getting Started

  1. Clone or download this repository.
  2. In your terminal, enter the php-website directory.
  3. Run php -S localhost:8000 to start the local webserver.

Instructions

  1. Visit http://localhost:8000/theme-src/ - This is the static HTML site. Use this for reference only.
  2. In a new tab, visit http://localhost:8000/www/index.php - This is your PHP version.
  3. Open www/index.php in your editor and include config.php at the top of your page.
  4. Use includes to add each of the four partials where indicated.
  5. Open www/_partials/header.php and use a foreach loop to output your navigation.
  6. Use an if statement to add the current class to correct <li> tag.
  7. Open www/_partials/scripts.php and use a foreach loop to output your scripts.
  8. Duplicate index.php as about.php and contact.php.
  9. Change the content of about.php to resemble theme-src/left-sidebar.html.
  10. Change the content of contact.php to resemble theme-src/right-sidebar.html.

About

This exercise allows you to practice includes, conditional logic, comparison operators and control structures.

Resources

Stars

Watchers

Forks