<?php
//including the class file
include('xPandMenu.php');
//creating a new menu object
$myMenu = new xPandMenu();
//adding the menu elements
$myMenu->addParent("CSS");
$myMenu->addChild("Zen Garden","http://www.csszengarden.com/");
$myMenu->addChild("W3C validator","http://jigsaw.w3.org/css-validator/validator-uri.html");
$myMenu->addParent("PHP");
$myMenu->addChild("PHP.NET","http://php.net");
$myMenu->addParent("MySQL");
$myMenu->addChild("The manual","http://dev.mysql.com/doc/mysql/en/index.html");
$myMenu->addChild("Full-text search functions","http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html");
$myMenu->addParent("Web Design");
$myMenu->addChild("A List Appart","http://www.alistapart.com/");
$myMenu->addChild("The color scheme generator","http://wellstyled.com/tools/colorscheme2/index-en.html");
//Generating the code
$code = $myMenu->generateMenu();
//$code is an associative array : ["js"=>{contains the javscript code},"html"=>{contains the html code}]
//Using the code in the webpage
echo "
<html>
<head>
<title>xPandMenu demo</title>
<script language=\"javascript\">
".$code['js']."
</script>
<style>
#parentX {
cursor:pointer;
font-family:georgia;
font-size:15px;
color:green;
font-weight:bold;
text-align:center;
background:#ccc;
height:20px;
margin-bottom:3px;
margin-top:3px;
}
#parentX:hover {
color:white;
}
#childX {
font-family:georgia;
font-size:12px;
color:#333;
background-image:url(images/background.gif);
text-align:center;
margin-bottom:2px;
margin-top:2px;
}
#childX a {
color:white;
text-decoration:none;
}
#childX a:hover {
color:gold;
text-decoration:none;
}
</style>
</head>
<body>
<div style=\"width:150px;\">
".$code['html']."
</div>
</body>
</html>
";
?>