PHP Classes

File: develop.php

Recommend this page to a friend!
  Classes of Anthony Rogers   XMLnav   develop.php   Download  
File: develop.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: 5,082 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
"develop": $loc = "Development"; break;
 }

 if( isset(
$menuitem) ){
  if(
$menuname == "develop" ){
   switch(
$menuitem){
    case
"ver01": $loc .= " > Version 0.1"; break;
    case
"ver02": $loc .= " > Version 0.2"; break;
    case
"ver03": $loc .= " > Version 0.3"; break;
    case
"ver04": $loc .= " > Version 0.4"; break;
    case
"ver05": $loc .= " > Version 0.5"; break;
    case
"ver1": $loc .= " > Version 1"; 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 == "develop" ){
 echo(
'<center><table border="0" width="90%">
<tr><th colspan="12">Development Stages</th></tr><tr>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="develop.php?menuname=develop&develop=ver01">Version 0.1</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="develop.php?menuname=develop&develop=ver02">Version 0.2</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="develop.php?menuname=develop&develop=ver03">Version 0.3</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="develop.php?menuname=develop&develop=ver04">Version 0.4</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="develop.php?menuname=develop&develop=ver05">Version 0.5</a></td>
<td width="20"><img src="images/burst.gif" width="20" height="20" /></td><td><a href="develop.php?menuname=develop&develop=ver1">Version 1</a></td>
</tr></table></center></td></tr><tr><td><hr width="70%" /></td></tr><tr>
<td valign="top">'
);
 if( isset(
$menuitem) ){
  print
"<b>Version ";
  switch(
$menuitem){
   case
"ver01": print "0.1</b> is the most basic version.\n<br />It just uses the first three tags:<ol type=\"1\">\n";
    print
"<li>&lt;menuBar></li>\n<li>&lt;item></li>\n<li>&lt;menu></li></ol>\nAnd prints the menu to the page."; break;
   case
"ver02": print "0.2</b> introduces the <tt>basePage</tt> attribute into the <tt>&lt;menuBar></tt> tag.\n<p>XMLmenu can now work over just the one page!";
    print
"\n<br />By using the <tt>basePage</tt> attribute in the <tt>&lt;menuBar></tt> and a <tt>menuname</tt> attribute in the first level <tt>&lt;item></tt> tag,";
    print
"\n<br />any first level <tt>&lt;item></tt> can be linked to the same page, but show a different page.\n<br />Take <a href=\"index.php\">index.php</a> as an example.</p>"; break;
   case
"ver03": print "0.3</b> introduces the <tt>&lt;link></tt> tag.\n<br />This new tag can be used to display an external website.\n<p>The <tt>target</tt> attribute is used in the same way as the <tt>target</tt> attribute in the <tt>&lt;a></tt> tag.</p>"; break;
   case
"ver04": print "0.4</b> adds extra options on how the menu is displayed by adding a couple of new functions to change the menu images."; break;
   case
"ver05": print "0.5</b> includes a new function that decides which menu levels to hide and display.\n<br />This is the new expandability function."; break;
   case
"ver1": print "1</b> introduces the <tt>&lt;email></tt> tag.\n<br />This new tag uses the same two attributes all of the others use, the <tt>name</tt> and <tt>level</tt> attribute, and uses two new ones, <tt>username</tt> and <tt>server</tt>.\n";
    print
"<br />It is these two new attributes that makes up the email address in the link.\n<p>This version changes the format of the <tt>printMenuItem()</tt> function and makes it slightly smaller.</p>"; break;
  }
 }else
 if(! isset(
$menuitem) ){
  print
"<b>This</b> section details the changes made between each version";
 }
}

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