Table of Contents

PHP Below the Root - Part 2

In the last part I discussed the file structure. Everything will come from one main script, (i.e. index.php)

that script will have the minimum of code, everything else will be fed from deeper libraries.

index.php

session_start();
ini_set('display_errors', 1);
 
// define base wanda path, below web root
 
$home = $_SERVER['SCRIPT_FILENAME'];
$loc = explode('/',$home);
 
define('WANDA_BASE', implode('/',array_slice($loc,0,-2)).'/');
 
// Hand over to the page handler
require WANDA_BASE.'wanda/inc/pagelib.php';

Thats it. What it does is define the path WANDA_BASE to below web root, then goes and includes the pagelib.php file, which partly includes much of what is needed to get around in the directories.

pagelib.php part 1

//define directory constants
 
// home page
    define('WANDA_INDEX', $home);
 
// above root libraries
    define('WANDA_LIB', implode('/',array_slice($loc,0,-1)).'/wanda2/');
 
// above root icon images
    define('WANDA_ICON', 'wanda2/icon/');
 
// above root images
    define('WANDA_IMAGE', 'wanda2/image/');
 
// below root apps folder
    define('WANDA_APPS', WANDA_BASE.'wanda/app/');
 
// below root includes (function libraries) folder
    define('WANDA_INC', WANDA_BASE.'wanda/inc/');
 
// System configurations folder (db settings, etc.
    define('WANDA_CONF', WANDA_BASE.'wanda/conf/');

Where to go from here?

so to call different programs we will need to have a system to have the core script make available or access the programs that will not be browser accessible.

The big challenge was figuring out where to go from here. I've devised three modes:

next

Next up I will go about highlighting some of the page access magic.

~~LINKBACK~~ ~~DISCUSSION~~