<?php
 
 
 
//including the class file
 
include('xPandMenu.php');
 
 
//creating a new menu object
 
$myMenu = new xPandMenu();
 
 
//setting the 2 images used as expand/collapse buttons
 
$myMenu->setXCbox(array("c"=>"http://project.zoe.co.nz/patrick/xpand/images/box_closed.gif","o"=>"http://project.zoe.co.nz/patrick/xpand/images/box_open.gif"),array("l"=>0,"r"=>28));
 
 
//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:verdana;
 
                font-size:12px;
 
                color:black;
 
                font-weight:bold;
 
                background-image:url(http://project.zoe.co.nz/patrick/xpand/images/folder.gif);
 
                background-repeat:no-repeat;
 
                background-position:15px;
 
                margin-bottom:3px;
 
                margin-top:3px;
 
            }
 
            #parentX:hover {
 
                text-decoration:underline;
 
            }
 
            #childX {
 
                font-family:verdana;
 
                font-size:11px;
 
                color:#333;
 
                padding-left:40px;
 
                border-left:1px dotted #696969;
 
                margin-left:4px;
 
                background-image:url(http://project.zoe.co.nz/patrick/xpand/images/document.gif);
 
                background-repeat:no-repeat;
 
                background-position:20px;
 
                padding-bottom:5px;
 
                padding-top:5px;
 
            }
 
            #childX a {
 
                color:#333;
 
                text-decoration:none;
 
            }
 
            #childX a:hover {
 
                color:#696969;
 
                text-decoration:underline;
 
            }
 
        </style>
 
    </head>
 
    <body>
 
        <div style=\"width:200px;\">
 
".$code['html']."
 
        </div>
 
    </body>
 
</html>
 
";
 
 
?>
 
 
 |