EMB Elizabeth Best's professional logo

Elizabeth M Best

Web Portfolio

Elizabeth Best's portrait

Portfolio Code Snips - Index

Index_Sample.php File


<?php 
/*** CODE SAMPLE: PORTFOLIO INDEX PAGE
Created by Elizabeth Best

This is a code sample similar to what I used to build my portfolio. It assumes you know HTML and a bit of PHP. I broke down sections of the HTML into php code segments to insert into this template to minimize the amount of coding when adding or re-arranging content.

The files names can be whatever you want to name them. I stored all of my reused sections, such as nav, header and footer in a single folder.

This index page is reusable and can be used for each and every main page of your site, provided with different "Main" content as seen below and appropriate file name. That is what makes this so versitile compared to using only HTML to build the site.

***/



/* ADD NOTES HERE if desired */



/** This is a file to decide which server (and thus which root) to use, a technique I found online to save having to change the web address, database logins, etc when uploading or downloading files for the site.
WARNING:  This file MUST exist (or code breaks) and should remain in site's root directory (although you can rename it).  **/
require('site-config_sample.php'); 


include('_html/head_sample.php'); // File containing meta, link, and <head> HTML tags for site  ?>

<title>My Website Title Here</title> <!-- not included in Head file so it can be customized for each page -->


<!-- can add page specific SEO stuff here --> 


<?php include('_html/header_sample.php');  //HTML <header> tag info

include('_html/mainNav_sample.php');	// main navigation section


// ADD fuctions or other any code specific to this page here


include('homePage_sample.php'); // This conatains the main content area, can break  down into multiple segments, separately call them from within 'homePage.php'file, or add plain HTML

include('_html/footer_sample.php'); //footer that's used on every page
?>