PHP Classes
elePHPant
Icontem

File: menu_test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Scott Mattocks  >  Cascading Menu  >  menu_test.php  >  Download  
File: menu_test.php
Role: Example script
Content type: text/plain
Description: Example of usage
Class: Cascading Menu
Creating cascading pop-up menus
Author: By
Last change:
Date: 11 years ago
Size: 1,710 bytes
 

Contents

Class file image Download
<html>
 <head>
  <style type="text/css">
   .menu {
   
   }
   .choice {
   
   }
   .sub {
    border: 1px solid #000000;
   }
  </style>
 </head>
 <body>
<?php
  
// Testing menu class
  
require_once('cascading_menu.class');

  
// Choices... choice(up image, down image, URL, image alt, css_class)
  
$c1 = new choice('test_up.gif','test_down.gif','test.php', 'TEST', 'choice');
  
$c2 = new choice('test_up.gif','test_down.gif','index.html', 'INDEX', 'choice');
  
$c3 = new choice('test_up.gif','test_down.gif','menu_test.php', 'THIS', 'choice');
  
$sc1 = new choice('test_up.gif','test_down.gif','index.html', 'SUB1', 'sub');
  
$sc2 = new choice('test_up.gif','test_down.gif','index.html', 'SUB2', 'sub');
  
$sc3 = new choice('test_up.gif','test_down.gif','index.html', 'SUB3', 'sub');
  
$sc4 = new choice('test_up.gif','test_down.gif','index.html', 'SUB-SUB1', 'sub-sub');
  
$sc5 = new choice('test_up.gif','test_down.gif','index.html', 'SUB-SUB1', 'sub-sub');
  
$sc6 = new choice('test_up.gif','test_down.gif','index.html', 'SUB-SUB1', 'sub-sub');
  
$sc7 = new choice('test_up.gif','test_down.gif','index.html', 'SUB-SUB1', 'sub-sub');

  
// Main menu... cascading_menu(top, left, height, width, css_class)
  
$m = new cascading_menu(15,9,20,399,'menu');

  
// Elements must be added in a top down manner
   // First level
  
$m->add($c2);
  
$m->add($c1);
  
$m->add($c3);

  
// Second level
  
$c1->add($sc1);
  
$c1->add($sc2);
  
$c3->add($sc6);
  
$c3->add($sc7);

  
// Third level
  
$sc2->add($sc4);
  
$sc2->add($sc5);

  
// Fourth level
  
$sc4->add($sc3);

  
// Output cascading menu
  
echo $m->write();
?>
</html>