PHP Dynamic Pages Showcase

Homepage

Project Overview

Project Explanation

In this project I used some basic PHP functionality to create dynamic pages based on variables and php if statements. I'm using include function to load the header and footer parts on all pages, this way I avoid having to write them and repeat the code four times (DRY Principle).

Before including the header part using include, I define three variables to hold the page title, the image path and the current page. I then use those variables in the header.php file to change dynamically the title inside the head tag, the cover image and the h2 subheader. Test page has default failover title and image path for when the variables are not defined. I have achieved this with the help of the isset function.

In addition to that I utilize if statements to enable an active css class on the navigation menu which changes the menu item background color when a page is active.

Lorem Ipsum