HTML and CSS Reference
In-Depth Information
At the bottom of index.php , add the URI parsing function using the code shown in bold:
//-----------------------------------------------------------------------------
// Initializes the app
//-----------------------------------------------------------------------------
// Starts the session
if (!isset($_SESSION)) {
session_start();
}
// Loads the configuration variables
require_once SYS_PATH . '/config/config.inc.php';
// Turns on error reporting if in debug mode
if (DEBUG===TRUE) {
ini_set('display_errors', 1);
error_reporting(E_ALL^E_STRICT);
} else {
ini_set('display_errors', 0);
error_reporting(0);
}
// Sets the timezone to avoid a notice
date_default_timezone_set(APP_TIMEZONE);
//-----------------------------------------------------------------------------
// Function declarations
//-----------------------------------------------------------------------------
/**
* Breaks the URI into an array at the slashes
*
* @return array The broken up URI
*/
function parse_uri( )
{
// Removes any subfolders in which the app is installed
$real_uri = preg_replace(
'~^'.APP_FOLDER.'~',
'',
$_SERVER['REQUEST_URI'],
1
);
$uri_array = explode('/', $real_uri);
// If the first element is empty, get rid of it
if (empty($uri_array[0])) {
array_shift($uri_array);
}
 
Search WWH ::




Custom Search