PHP Classes

File: files.php

Recommend this page to a friend!
  Classes of Anthony Rogers   XMLnav   files.php   Download  
File: files.php
Role: Example script
Content type: text/plain
Description: Documentation & example
Class: XMLnav
Creates a menu bar from a definition in XML
Author: By
Last change: Changes to version numbering
Date: 16 years ago
Size: 8,247 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><?php
if( isset($_GET["menuname"]) ) $menuname = $_GET["menuname"];
if( isset(
$_GET["item"]) ) $item = $_GET["item"];

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

 switch(
$menuname){
  case
"files": $loc = "Files"; break;
 }

 if( isset(
$menuitem) ){
  if(
$menuname == "files" ){
   switch(
$menuitem){
    case
"imgs": $loc .= " > Images"; break;
    case
"develop_php": $loc .= " > develop.php"; break;
    case
"files_php": $loc .= " > files.php"; break;
    case
"index_php": $loc .= " > index.php"; break;
    case
"license_txt": $loc .= " > license.txt"; break;
    case
"nav_xsd": $loc .= " > nav.xsd"; break;
    case
"test_php": $loc .= " > test.php"; break;
    case
"test_xml": $loc .= " > test.xml"; break;
    case
"xmlmenu_php": $loc .= " > xmlmenu_class.php"; break;
   }
  }
 }
}

if( isset(
$item) ){
 if( isset(
$_GET[$item]) ) $submenuitem = $_GET[$item];
 if( isset(
$submenuitem) ){
  if(
$menuitem == "imgs" ){
   switch(
$submenuitem){
    case
"burst_gif": $loc .= " > burst.gif"; break;
    case
"email_gif": $loc .= " > email.gif"; break;
    case
"file_gif": $loc .= " > file.gif"; break;
    case
"folder_gif": $loc .= " > folder.gif"; break;
    case
"folder_open_gif": $loc .= " > folder.open.gif"; break;
    case
"link_gif": $loc .= " > link.gif"; break;
   }
  }
 }
}

print
$loc;
?></title>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<th colspan="2"><h1>XMLmenu</h1></th>
</tr><tr><td colspan="2" height="5"><hr width="85%" /></td></tr><tr>
<td width="180" valign="top"><?php
//Generate the menu...
$QueryVars = $_GET;
$XMLmenu = new XMLmenu("test.xml", $QueryVars);
$XMLmenu->Generate();
?></td>
<td valign="top"><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<th><h2><?php print $loc; ?></h2></th>
</tr><tr><td height="5"><hr width="70%" /></td></tr><tr>
<td valign="top"><?php

if( isset($menuname) && $menuname == "files" ){
 echo(
'<center><table border="0" width="90%">
<tr><th colspan="12">Files</th></tr><tr>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=imgs&item=images">Images</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=develop_php">develop.php</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=files_php">files.php</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=index_php">index.php</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=license_txt">license.txt</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=nav_xsd">nav.xsd</a></td>
</tr><tr>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=test_php">test.php</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=test_xml">test.xml</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td colspan="7"><a href="files.php?menuname=files&files=xmlmenu_php">xmlmenu_class.php</a></td>
</tr></table></center></td></tr><tr><td><hr width="70%" /></td></tr><tr>
<td valign="top">'
);
 if( isset(
$menuitem) && $menuitem != "imgs" ){
  switch(
$menuitem){
    case
"develop_php": print "<b>This</b> is the file for the <a href=\"develop.php?menuname=develop\">Development</a> section"; break;
    case
"files_php": print "<b>This</b> is the file for this section"; break;
    case
"index_php": print "<b>This</b> is the file for the <a href=\"index.php?menuname=home\">Home</a> page"; break;
    case
"license_txt": print "<b>This</b> is the license<pre>"; include("license.txt"); print "</pre>"; break;
    case
"nav_xsd": print "<b>This</b> files is the XML Schema for the XML document\n<p><a href=\"nav.xsd\" target=\"_blank\">View File</a></p>"; break;
    case
"test_php": print "<b>This</b> file uses the same xml file as this document, its just a shorter, and more manageable, example\n<p><a href=\"test.php\" target=\"_blank\">View File</a></p>"; break;
    case
"test_xml": print "<b>This</b> is the XML document that describes the menu, and is used as example\n<p><a href=\"test.xml\" target=\"_blank\">View File</a></p>"; break;
    case
"xmlmenu_php": print "<b>This</b> is the PHP class that creates the menu"; break;
  }
 }else
 if( isset(
$menuitem) && $menuitem == "imgs" ){
  echo(
'<center><table border="0" width="90%">
<tr><th colspan="12">Images</th></tr><tr>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=imgs&item=images&images=burst_gif">burst.gif</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=imgs&item=images&images=email_gif">email.gif</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=imgs&item=images&images=file_gif">file.gif</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=imgs&item=images&images=folder_gif">folder.gif</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=imgs&item=images&images=folder_open_gif">folder.open.gif</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="files.php?menuname=files&files=imgs&item=images&images=link_gif">link.gif</a></td>
</tr></table></center></td></tr><tr><td><hr width="70%" /></td></tr><tr>
<td valign="top">'
);
  if( isset(
$submenuitem) ){
   switch(
$submenuitem){
    case
"burst_gif": print "<b>This</b> image is used in the table above <img src=\"images/burst.gif\" width=\"20\" height=\"20\" />"; break;
    case
"email_gif": print "<b>This</b> image is used for the email link in the menu bar <img src=\"images/email.gif\" width=\"27\" height=\"20\" />";
     print
"\n<br />This image can be changed for one of your choice"; break;
    case
"file_gif": print "<b>This</b> image is used for an item in the menu bar <img src=\"images/file.gif\" width=\"27\" height=\"20\" />";
     print
"\n<br />This image can be changed for one of your choice"; break;
    case
"folder_gif": print "<b>This</b> image is used for a closed menu link in the menu bar <img src=\"images/folder.gif\" width=\"27\" height=\"20\" />";
     print
"\n<br />This image can be changed for one of your choice"; break;
    case
"folder_open_gif": print "<b>This</b> image is used for an open menu link in the menu bar <img src=\"images/folder.open.gif\" width=\"27\" height=\"20\" />";
     print
"\n<br />This image can be changed for one of your choice"; break;
    case
"link_gif": print "<b>This</b> image is used for an external link in the menu bar <img src=\"images/link.gif\" width=\"27\" height=\"20\" />";
     print
"\n<br />This image can be changed for one of your choice"; break;
   }
  }else
  if(! isset(
$submenuitem) ){
   print
"<b>This</b> section explains the images that can be found in the images folder";
  }
 }else
 if(! isset(
$menuitem) ){
  print
"<b>This</b> section explains the files";
 }
}

?></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>