WME Page Templates

Every page in the WME site must be constructed using the following template. This template assures that the various WME configuration and utilities files are included. It takes care of database connectivity, session initialization, defines WME global variables, and WME-provided functions.

The WME page template is shown below:

<?php

/**
 *    Teacher's Guide
 *    @author David Chiu
 *    @date 8/6/2005
 *    @modified
 *
 */

// Configuration File
require_once "wme_site_config.inc.php";


/*************************************
 Define Standard Page Values
*************************************/

// Title of this page
$_WME_PAGE_STD['TITLE'] = "";

// Heading of the page, which is often the same as the title
$_WME_PAGE_STD['HEADING'] = "";

// Set the breadcrumb string
// Only change the value if you want to explicitly set the breadcrumb string!
$_WME_PAGE_STD['BREADCRUMB'] = _WME_GET_BREADCRUMB("&gt;");

// List of stylesheets in this form
// "url_to_stylesheet1.css,url_to_stylesheet2.css,..."
$_WME_PAGE_STD['STYLESHEETS'] = "";

// List of scripts needed for this page in this form
// "url_to_script1.js,url_to_script2.js,..."
$_WME_PAGE_STD['JAVASCRIPT'] = "";


/*************************************
 North Template inclusion
*************************************/

include_once $_WME['FS_TEMPLATES_DIR'] . "north.inc.php";


/*** Start of page content ***/

?>

<!-- content starts here -->

<?php

    
// see if for TM or TLP
    
if (isset($_GET['tmID']))
        
$ug_ref _WME_GET_TM_REF($_GET['tmID']);
    else if (isset(
$_GET['tlpID']))
        
$ug_ref _WME_GET_TLP_REF($_GET['tlpID']);

    
//get teacher's guide info
    
$ug mysql_fetch_object($ug_ref);
    
$ug_text $ug->user_guide;

    
//display
    
echo $ug_text;
?>



<!-- content ends here -->

<?php

/*** End of page content ***/

/*************************************
 South Template inclusion
*************************************/

include_once $_WME['FS_TEMPLATES_DIR'] . "south.inc.php";

?>


You must use this template to create every file intended for display on the WME site. Some files, like those in the administrative areas, require login. The following shows the template and includes login handling.

<?php

/**
 *    Title of Page
 *    @author Author's name
 *    @date
 *    @modified
 *
 */

// Configuration File
require_once "wme_site_config.inc.php";


/*************************************
 Define Standard Page Values
*************************************/

// Title of this page
$_WME_PAGE_STD['TITLE'] = "";

// Heading of the page, which is often the same as the title
$_WME_PAGE_STD['HEADING'] = "";

// Set the breadcrumb string
// Only change the value if you want to explicitly set the breadcrumb string!
$_WME_PAGE_STD['BREADCRUMB'] = _WME_GET_BREADCRUMB("&gt;");

// List of stylesheets in this form
// "url_to_stylesheet1.css,url_to_stylesheet2.css,..."
$_WME_PAGE_STD['STYLESHEETS'] = "";

// List of scripts needed for this page in this form
// "url_to_script1.js,url_to_script2.js,..."
$_WME_PAGE_STD['JAVASCRIPT'] = "";


/*************************************
 North Template inclusion
*************************************/

include_once $_WME['FS_TEMPLATES_DIR'] . "north.inc.php";


/*** Start of page content ***/

?>

<?php

// Check for Login

if (!_WME_USER_IS_LOGGED_IN()) //User not logged in
    
_WME_PRINT_LOGIN_FORM("wme_admin_action.php?type=login");

else {
    
_WME_PRINT_LOGIN_WELCOME();
?>
<br /><br />

<?php
    
// We use _WME_IS_ADMIN() here to check for admin status
    // Use _WME_IS_TEACHER to check for teacher status,
    //       _WME_IS_STUDENT to check for student status
    
if (!_WME_IS_ADMIN($_SESSION['USER_ID'])) {
        
//Not an admin. Deny access!
        
echo "You do not have administrator rights to perform this action. <a href=\"".$_WME['WS_ADMIN_URL']."\">Go back.</a>";
    }
    else {
?>

<!-- content starts here -->




<!-- content ends here -->

<?php
    
}
}
?>

<?php

/*** End of page content ***/

/*************************************
 South Template inclusion
*************************************/

include_once $_WME['FS_TEMPLATES_DIR'] . "south.inc.php";

?>


Back to Topics