Marc Horner ZCE Project
Site Infrastructure Overview
The site uses the following .htaccess file
.htaccess.php |
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ index.php?var1=$1 [L]
RewriteRule ^([^\.\?/]+)/([^\.\?/]+)$ index.php?var1=$1&var2=$2 [L]
RewriteRule ^([^\.\?/]+)/([^\.\?/]+)/([^\.\?/]+)$ index.php?var1=$1&var2=$2&var3=$3 [L]
ErrorDocument 404 /404error.html
Example URLs:
http://www.website.com/news/21
rewrites to
http://www.website.com/index.php?var1=news&var2=21
http://www.website.com/news/21/edit
rewrites to
http://www.website.com/index.php?var1=news&var2=21&var3=edit
|
All PHP calls go through the index.php file and follow the flow as below
index.php |
include the php_includes/common-header.php
file
php_includes/common-header.php |
includes external resource files
php_includes/config.php |
Config file does the following tasks:- Assigns values to $siteTitle, $siteLocation, $mediaLocation. These are used widely across the
- site to ensure all links are pointing to the correct folders. These can be changed to any string values and the site will still work (as long as the locations are real)
- Open connection to MySQL DB
- Initialise session TO BE REPLACED BY COOKIE
- Array containing details regarding the pages on the site. Sets default page is no page exists. Array contains information such as "page title" and location of page in content folder.
- Check if page user has selected exists in the array. If not, display a default 404 message
- If user is logged in, updates the user's 'lastseen' field with the current time.
|
php_includes/functions.php |
various functions including:
changing email address format,
truncating long strings
replacing non-alphanumeric characters with “-“ to create SEO URLs
convert entities in data
“:-)” is converted to the location of a smiley image etc..
Add a suffix to the end of a number “th”, “nd”, “rd” |
php_includes/classes.php |
various object classes including
build links from url components |
Determines if user has requested to log out and clears session details if so
Opens <html> tag
Displays header information
Opens up <body> tag
Displays top level navigation
Displays left navigation and right information areas
|
pulls in the name of the page from the content/ folder that corresponds to which the user is looking at. Over-rides with the login page if user has selected to login
content/$_var1.php |
Brgins in a page depending on which user has selected to view. If none selcted, default already set in config include.
|
Pulls in the footer file
php_includes/common-footer.php |
Footer navigation, copyright information
Closes <body> tag
Closes <html> tag |
|