PHP Classes
Icontem

File: demo_win.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Patrick Brosset  >  xPandMenu  >  demo_win.php  
File: demo_win.php
Role: Example script
Content type: text/plain
Description: How to use the class, demo file, windows style
Class: xPandMenu
Generate a dynamic hierarchic menu
 

Contents

Class file image Download
<?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>
"
;

?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products