The WebMenu Class
| CollapsableMenu |
Single Line Menu |
|
|
|
QuickNavigationMenu |
QuickParentNavigationMenu |
|
|
|
| MultiLineMenu |
|
The WebMenu Class object is a subclass of the WebPage Class object, so it is initialized in the same way, except that the class argument defaults to "menu" or whatever value has been set by the SetMenuClass function. The here argument defaults to "here" or whatever value has been set by the SetHereClass function. You can give specific pages specific classes. Remember that these classes refer to a Cascading Style Sheet declaration.
The WebMenu object is the main tool for the WebMenu module. You can create every menu with calls from the main menu item.
The public methods of the WebMenu class are:
-
Tag
-
This attribute can be changed. Any menu creation functions called after changing the Tag attribute will show this change.
-
Separator
-
This attribute can be changed. Any menu creation functions called after changing the Separator attribute will show this change. The Separator is only used in MultiLineMenu() calls.
-
Add(p)
-
Adds the WebPage or WebMenu class object to the menu. It raises an error if the object is not an instance of WebPage or WebMenu.
-
CreateMenu([h=[]])
-
CreateMenu returns an HTML string wrapped in the MenuTag tag and given the MenuClass CSS class. It lists all of the items in the menu, but does not follow any submenus. The argument h is a list of titles in the current path. This method is used in MultiLineMenu
-
SingleLineMenu(item)
-
Returns an HTML formatted string to the menu object whose title or key matches the string item.
-
MultiLineMenu(item)
-
Returns several menus, as necessary to the menu object whose title or key matches the string item.
-
QuickNavigationMenu(item,[prv="<<",nxt=">>"]
-
Returns an HTML formatted string for the menu object whose title or key matches the string. The titles of the links are not used, but the text provided by the prv and nxt arguments are written.
-
QuickParentNavigationMenu(item,[prv="<<",par="^",nxt=">>"])
-
As above, but adds a link to the menu item's parent (if it exists) in between the other menus.
-
CreateSiteList()
-
CreateSiteList() returns an unordered list of links in a menu and all submenus. If called from the top of the menu tree it will list all sites. If called from a page object it starts at the pages parent menu. If called from a menu it will list all of the links in itself and all submenus. The list is given a CSS class style of 'sitelist'
-
CollapsableMenu(item)
-
CollapsableMenu will create a menu designed to be used as a sidebar. It doesn't use the same set of defaults as the other kinds of menus for the menuclass, linkclass, pageclass, and hereclass styles. For the menu items themselves it uses a list of classes. The default is ["main", "sub1", "sub2", "sub3", "sub 4"]. This allows you to declare difference styles for each level in the menu. Instead of the HereClass it uses the SHereClass variable. This allows a collapsable menu on the side without destroying the way other menu's have been drawn.
There are other functions but they probably won't be called by users. See the document strings for more information.
Here are some examples of the HTML that is returned for the menus on this minisite.
>>>myMenu.SingleLineMenu('intro')
<p class="menu">
<a href="webmenu.html" class="link">WebMenu Documentation</a>>>
<a href="intro.html" class="page">Introduction</a>
</p>
>>>myMenu.MultiLineMenu('adding')
<p class="menu">
<a href="intro.html" class="page">Introduction</a> |
<a href="python.html" class="here">Creating Menus in Python</a> |
<a href="webpageclass.html" class="page">The WebPage Class</a> |
<a href="webmenuclass.html" class="page">The WebMenu Class</a> |
<a href="xml.html" class="page">Using XML to define a Web Menu object</a> |
<a href="questions.html" class="page">Questions about WebMenu</a>
</p>
<p class="menu">
<a href="default.html" class="page">Setting the Defaults</a> · <a href="adding.html" class="here">Adding Pages and Menus</a>
</p>
Back to my code page
Back to my home page
©2003 english@spiritone.com