Sitellite Application Framework
Class Tree         Index         All Elements

Class: DropMenuItem

Source Location: Program_Root/GUI/DropMenuItem.php

Class Overview


DropMenuItem provides individual menu item facilities to the DropMenu class, which generates HTML and JavaScript for DHTML drop menus.


Author(s)

Version

  • 1.0, 2002-10-28, $Id: DropMenuItem.php,v 1.3 2006/04/29 16:54:13 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 77]
DropMenuItem provides individual menu item facilities to the DropMenu class, which generates HTML and JavaScript for DHTML drop menus.

New in 1.0:

  • Fixed some outdated javascript mouse tracking function references.

1 <?php
2
3 $dropMenu = new DropMenu ('company', 10, 30);
4
5 // set a background colour change on each item
6 $dropMenu->extraMouseOver = 'sdmSetBgcolor (\'_td_{layerID}\', \'#CCCCCC\')';
7 $dropMenu->extraMouseOut = 'sdmSetBgcolor (\'_td_{layerID}\', \'#FFFFFF\');
8
9 $aboutItem =& $dropMenu->addItem ('About Us', '/index/about');
10 $aboutMenu =& $aboutItem->addChild ('about');
11
12 $aboutMenu->addItem ('Corporate Profile', '/index/corporate');
13 $aboutMenu->addItem ('History', '/index/history');
14 $invItem =& $aboutMenu->addItem ('Investor Relations', '/index/investors');
15 $invMenu =& $invItem->addChild ('inv');
16 $invMenu->addItem ('Annual Report', '/index/annual_report');
17
18 $aboutMenu->addItem ('Contact Us', '/index/contact');
19
20 // create the drop menu divs
21 echo $dropMenu->write ();
22
23 // next, we need the dropmenu.js file
24 echo '<script language="javascript1.2" src="/js/dropmenu.js"></script>';
25
26 // we also need a javascript list of menus called menuList
27 echo '<script language="javascript1.2"><!--' . "\n";
28 echo "sdmMenuList = new Array ('" . join ("', '", $dropMenu->getList ()) . "');\n";
29 echo '// --></script>';
30
31 // attach this drop menu to something visible on the page.
32 echo '<a href="/index/company" onmouseover="sdmShowAndHide(\'company\')">Company</a>';
33
34 ? >




Tags:

access:  public
version:  1.0, 2002-10-28, $Id: DropMenuItem.php,v 1.3 2006/04/29 16:54:13 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$child =

[line 152]

The child DropMenu object of this item.



Tags:

access:  public

Type:   mixed


[ Top ]

$direction =  'right'

[line 169]

The direction of the drop menu this item is a part of. Used for inheriting to a child menu.



Tags:

access:  public

Type:   mixed


[ Top ]

$extraMouseOut =  ''

[line 185]

Optional extra JavaScript to call when the item loses focus.



Tags:

access:  public

Type:   mixed


[ Top ]

$extraMouseOver =  ''

[line 177]

Optional extra JavaScript to call when the item is in focus.



Tags:

access:  public

Type:   mixed


[ Top ]

$lineHeight =

[line 144]

The height of this item and each item in its parent drop menu.

Used for inheriting to a child menu.




Tags:

access:  public

Type:   mixed


[ Top ]

$link =

[line 92]

The URL to link this item to.



Tags:

access:  public

Type:   mixed


[ Top ]

$menuWidth =

[line 135]

The width of the drop menu this item is a part of. Used for inheriting to a child menu.



Tags:

access:  public

Type:   mixed


[ Top ]

$menu_tpl =

[line 108]

The menu template to use to generate child drop menus.



Tags:

access:  public

Type:   mixed


[ Top ]

$template =

[line 100]

The template to use to generate the menu item.



Tags:

access:  public

Type:   mixed


[ Top ]

$text =

[line 84]

The text of the menu item.



Tags:

access:  public

Type:   mixed


[ Top ]

$xpos =

[line 117]

The x position of the drop menu this item is a part of. Used for inheriting to a child menu.



Tags:

access:  public

Type:   mixed


[ Top ]

$ypos =

[line 126]

The y position of the drop menu this item is a part of. Used for inheriting to a child menu.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor DropMenuItem [line 201]

DropMenuItem DropMenuItem( string $text, string $link, [integer $xpos = 0], [integer $ypos = 0], [integer $menuWidth = 150], [integer $lineHeight = 18], [string $menu_tpl = ''], [string $link_tpl = ''])

Constructor method.



Tags:

access:  public


Parameters:

string   $text  
string   $link  
integer   $xpos  
integer   $ypos  
integer   $menuWidth  
integer   $lineHeight  
string   $menu_tpl  
string   $link_tpl  

[ Top ]

method addChild [line 276]

object &addChild( string $name)

Creates a new DropMenu class, passing on what info is required, and adding it to the child property. Note: an item may have only one child menu.



Tags:

access:  public


Parameters:

string   $name  

[ Top ]

method write [line 232]

string write( [string $show = ''])

Writes the drop menu item, as well as any child menus, and returns it as a string. The 'show' property is for internal use, as this method may be called again by one of the items inside this child's menu if it has any child menus.



Tags:

access:  public


Parameters:

string   $show  

[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:17:28 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2