PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Anthony Rogers   XMLnav   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Simple shorter example
Class: XMLnav
Creates a menu bar from a definition in XML
Author: By
Last change: Changes to version numbering
Date: 15 years ago
Size: 2,123 bytes
 

Contents

Class file image Download
<?php
require("xmlmenu_class.php");

/*--------------------------------------------------------------------------------------*\
 * Copyright (C) 2004-2005 Anthony K Rogers roggyadres@hotmail.com *
 * *
 * This file is part of XMLmenu. It gives a quick example of how it is implemented *
 * *
 * version 1.0 *
 * copyright 2004 *
\*--------------------------------------------------------------------------------------*/

?>
<html>
<head>
<title></title>
</head>
<body>
<?php
//Generate the menu...
$QueryVars = $_GET;
$XMLmenu = new XMLmenu("test.xml", $QueryVars);

//Yes I know these are default values, its just here as an example
//You don't need to include all of them
//If you only want to change the email link image, just include that one
$XMLmenu->menuIMG(27, 20); //the image dimensions (Width, Height)
$XMLmenu->fileIMG("images/file.gif"); //a file image
$XMLmenu->folderIMG("images/folder.gif", "images/folder.open.gif"); //closed and open folder image
$XMLmenu->linkIMG("images/link.gif"); //external link image
$XMLmenu->emailIMG("images/email.gif"); //email link image

$XMLmenu->Generate();


//Following is an example of how you would check which page was being looked at at the time.
if( isset($_GET["menuname"]) ) $menuname = $_GET["menuname"];
if( isset(
$_GET["item"]) ) $item = $_GET["item"];

if(! isset(
$menuname) ) $loc = "Home";
if( isset(
$menuname) ){ //IF 1
 
if( isset($_GET[$menuname]) ) $menuitem = $_GET[$menuname];

 switch(
$menuname){ //SWITCH 2
 
case "home": $loc = "Home"; break;
  case
"about": $loc = "About"; break;
  case
"how": $loc = "How to Use"; break;
  case
"future": $loc = "Future Developments"; break;
 }
//SWITCH 2

 
if( isset($menuitem) ){ //IF 3
 
if( $menuname == "how" ){ //IF 4
  
switch($menuitem){ //SWITCH 5
   
case "1": $loc .= " > Step 1"; break;
    case
"2": $loc .= " > Step 2"; break;
    case
"3": $loc .= " > Step 3"; break;
    case
"4": $loc .= " > Step 4"; break;
   }
//SWITCH 5
 
} //IF 4
 
} //IF 3
} //IF 1

print $loc;

?>
</body>
</html>