Category Archives: PHP

PHP – Adding Functions to Your Template

This demonstration series will show you how you can create and include a ‘functions.php’ external file to your Project1 template.

Specifically, you will learn how to create and implement a script as a user-defined function that dynamically names the following on all the pages:

  • <title></title>
  • the banner area’s <h1></h1>
  • a class/ID name to be used wherever you wish
  • <img> source file and its alt text

You will see how to implement it by declaring the function in an external ‘functions.php’ file, including the ‘functions.php’ file inside the ‘head.inc.php’ file, and also calling the function inside the ‘head.inc.php’ file so that you can use its global scope variables anywhere within the template’s component pages.

Lastly, the demo also explains the difference between echoing the function’s results vs. using the stored variable values generated by a function from an external include() page.

Continue reading PHP – Adding Functions to Your Template

CSS – Creating a Mobile-First Design Template

Creating a Mobile-First Design Template for Your PHP Project

This demo will give you guidance in styling a web page with HTML5 markup from a mobile-first design approach. It covers the following concepts, principles, and methods:

  • the php/html starter file’s proper markup
  • how to add Google Fonts to a design
  • using a viewport/device-width meta tag
  • removing native browser styling with a ‘reset’ css file
  • using @viewport and @-ms-viewport in CSS
  • designing for smallest screens in mind first
  • using @media queries to alter layout on larger screens
  • styling a baseline for very commonly used elements

To follow along with these videos using the exact same markup, you can download the template ‘project1’ folder in a zipped file. After downloading, unzip and place the unzipped folder into your “htdocs/dev/” folder to work on the files.

Project1 – 00 Getting Started 14:57


Project1 – 01 Start Styling 14:36


Project1 – 02 Styling the Banner 14:26


Project1 – 03 Styling the Banner NAV 12:02


Project1 – 04 Styling the Banner NAV Media Query 13:02


Project1 – 05 Styling the Baseline Content 14:59


Project1 – 06 Styling the Footer 14:56


 

Useful Project Resources

XAMPP – TURN YOUR MAC INTO A DEVELOPMENT SERVER

Installing XAMPP on your MAC personal computer

XAMPP stands for “X (one of four OSs), Apache, MySQL, PHP, PERL” and is used to enable your personal computer with the web and database tools necessary to host its own dynamically driven websites for testing and development purposes. The following tutorial video demonstrations will show you the steps to set your computer up as a “localhost” server on a Mac. Continue reading XAMPP – TURN YOUR MAC INTO A DEVELOPMENT SERVER

XAMPP – Turn your PC into a development server

Installing XAMPP on your personal computer

XAMPP stands for “X (one of four OSs), Apache, MySQL, PHP, PERL” and is used to enable your personal computer with the web and database tools necessary to host its own dynamically driven websites for testing and development purposes. The following tutorial video demonstrations will show you the steps to set your computer up as a “localhost” server on Windows. Continue reading XAMPP – Turn your PC into a development server

MAMP – Turn your Mac into a development server

Installing MAMP on your personal computer

MAMP stands for “Mac Apache, MySQL, PHP” and is used to enable your personal computer with the web and database tools necessary to host its own dynamically driven websites for testing and development purposes. The following tutorial video demonstrations will show you the steps to set your computer up as a “localhost” server. Continue reading MAMP – Turn your Mac into a development server

PHP – Lesson 11: Using COOKIE and SESSION

This lesson demonstrates how the PHP  $_COOKIE and $_SESSION superglobal arrays work. On this page are three slideshow/demo videos, as follows:

  • Slideshow lesson on how we use $_COOKIE and $_SESSION to get info from users
  • Demonstration on how to build simple, basic code to illustrate $_COOKIE
  • Demonstration on how to build simple, basic code to illustrate $_SESSION

Continue reading PHP – Lesson 11: Using COOKIE and SESSION