Location: PHPKode > scripts > Template Module > template-module/index.php
<?PHP
/**
 * index - holds switches for quote module
 *
 * This is the hub of the template module. All operational
 * decisions are made here.
 *
 * @module template
 * @package phpWebSite
 * @author Edward Ritter <hide@address.com>
 * @version $Id: index.php,v 1.2 2002/09/03 19:44:31 esritter Exp $
*/

/**
 * These variables are used during installation of the module.
 * You can also reference them throughout your module should you 
 * need them. Please set these.
 */
$modname = 'template';				// set this to the short name for your module (its subdirectory)
$module_long_name = 'My Template';	// Name of module as known by users
$module_icon = "$modname.gif";		// small icon file for the module on global admin menu
$admin_only = 0;					// set to 1 if this is for admins only
$user_only = 0;						// set to 1 if this is for users only
$misc_info = "<version> by <author> <email>";	// usually version, author info
$block_display_position = 16;		// see README for the codes. 16 sets it to show
									// on left, topcenter and right. 1 is just left.

// Include necessary core files
if (!isset ($mainfile)) include ('mainfile.php');
include_once ('config.php');
include_once ('open_session.php');

// Display header
include_once ('header.php');

// Admin only operations
if ($admintest == $security_hash) {
	switch($op) {
		/* Calls the install include. If the install include generates any
		   errors, it will display the errors in a box, otherwise displays
		   that the module was successfully installed with a link back to 
           the administration menu. */
		case "install":
			include_once ("./mod/$modname/".$modname."_install.inc.php");
			if (!$box_content) {
				$box_content = "<p>\"$modname\" was successfully installed.</p>
					<p><a href=\"admin.php\">Return to Site Administration</a></p>";
			}
			$box_title = "$module_long_name Install";
			//thememainbox($box_title, $box_content);
			break;

		/* Calls the uninstall include. If the uninstall include generates any
		   errors, it will display the errors in a box, otherwise displays
           that the module was successfully uninstalled with a link back to
           the administration menu. */
		case "uninstall" :
			include_once ("./mod/$modname/".$modname."_uninstall.inc.php");
			if (!$box_content) {
				$box_content = "<p>\"$modname\" was successfully uninstalled.</p>
					<p><a href=\"admin.php\">Return to Site Administration</a></p>";
			}
			$box_title = "$module_long_name Uninstall";
			//thememainbox($box_title, $box_content);
			break;
		
		/* Calls the admin include, which has another switch ($adminop) for
		   admin only operations. */ 
		case $modname . "_admin" :
			include_once ("./mod/$modname/".$modname."_admin.inc.php");
			break;
		/* DO NOT INCLUDE A DEFAULT CASE! Otherwise, it will not continue
		   to the user's operations switch below. */

	}
} else {
    /* Displayed when trying to use the above switches without being logged
       in as an admin. */
    $box_title = "Unauthorized Access";
    $box_content = "<p class=\"onebiggerred\">You need to be logged in as 
    	an admin to perform this operation.</p>";
    thememainbox($box_title, $box_content);
}

/* Place any operations switches that are available to everyone 
   here.*/
switch ($op) {
	/* By default, this switch will load the mainpage include for
	   this module if no $op is given. */
	default:
		if (!$op) {
			include ("./mod/$modname/".$modname."_mainpage.inc.php");
			thememainbox($box_title, $box_content);
		}	
		break;

}

// Display footer
include_once ('footer.php');

?>
Return current item: Template Module