Skip to content
Permalink
2017-11-12
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?
Go to file
 
 
Cannot retrieve contributors at this time
22 lines (19 sloc) 1.34 KB
# 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`.