Skip to content
154f8a5ea1
Go to file
Code

Latest commit

 

Git stats

Files

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

README.md

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

You can’t perform that action at this time.