Layout Management Through Redbourne Macro Tags

run example

overview   applications   limitations   structure diagram   files   details

Overview

This is an example that illustrates the usage of Redbourne macro tags to create a menu structure for your website. Commonly a web page will have a menu structure on the left-hand side. This menu will then be used to navigate throughout the website. Redbourne have provided a number of macro tags that support the quick deployment of such a menu. This support is very flexible and allows different menus/sub-menus to be dynamically managed as required.

The menu item attributes can also be altered in a very flexible manner and this is demonstrated well in the sample application. As expected, the hypertext links associated with each menu item will 'jump' to web pages or bookmarks. In addition, Redbourne have created other macro tags which divide a web page into sections. These sections can then be referenced by hypertext links which can then allow different parts of a web page to be shown separately as required. Finally, the example application will show that with a small change, the web page can be switched to be 'printer-friendly' by only displaying the body content.

Applications

This example application is applicable to all sites requiring a quickly deployable and flexible menu.

Limitations


There are no specific limitations of note.


Structure Diagram

Application

Files  

Application

1. rbpagemenu.inc This include file holds redbourne information used by ALL the example web pages to support the redbourne menu item macro tags.
2. index.rhtm This page is the start of the application. It displays a simple menu structure and provides access to all other examples.
3. menuSampleTop.inc This include file holds top menu information (HOME) used by all example web pages.
4. menuSampleLevel2.inc This include file holds sub-menu (level two) information used by all but one of the example web pages.
5. menuSampleLevel3Basic.inc This include file holds sub-menu (level three) information used by the basic menu structure example below.
6. menuSampleBasic1.rhtm This file provides a basic 3-tier menu structure by use of the three include files above.
7. menuSampleAtt1.rhtm This web page has the same text as the start page except that layout attributes have been added.
8. menuSampleSections.rhtm This webpage displays how menu items can support sections within web page content.
9. menuSampleLevel3Sections.inc This include file supports the functionality displayed by the sections web page. This file is similar in ilk to the menuSampleBasic.inc file except that the hypertext links point to sections in a single web page.
10. menuSampleSectionsb.rhtm This webpage displays how menu items can be auto-generated from the page by use of sections.

Detailed Explanation of Macro Tag Usage

It is simple to setup a menu structure using Redbourne's macro tags. All the functionality needed to process the information you provide is contained in an include file named 'rbpagemenu.inc'. What goes on inside this file need not concern you - all that is required is knowledge of the interface syntax. The examples break up the menu structure into three include files, one for each layer. These three include files could have actually been combined into one file. The attributes of menu items could also have been put into the include files. This is the entry for the top level menu item named home (menuSampleTop.inc)

<rbm:menuitem name="Home" href="/example5/menuSample1.rhtm " key="top" />


Here the name is what will be displayed and represents a unique reference to that menu item. However, you may want to use the same name lower down in the tree (eg introduction). To this end, you may provide a value for key which must be unique throughout the tree (but will not be displayed). The value for href is the hypertext link to another web page, bookmark or section.

To create a hierarchy of menu items you would now continue to add additional lines of code as above except that they will be encapsulated as follows:(menuSampleLevel2.inc)

<rbm:menuitem parent = "top">

<rbm:menuitem name="Basic menu" href="/example5/menuSampleBasic1.rhtm " key="basic"/>

</rbm:menuitem>


The only addition is that the new set of menus comes under the parent of "top" (which is the key value for the first menu item created). Now that you have your menu structure you can divide it up into include files, probably one for each level of the menu.
The attributes of a menu item can be changed by creating a Redbourne block having set attributes and cross-referencing the blocks id to the menu item:(menuSampleAtt1.rhtm) <rb:block rb:id="menu3text"><font face = "arial" color = "ffffff"><h6>item1</h6></font></rb:block> <rbm:menuitem blockid="menu3text" href="#"/> Here the block is created with a unique name, provided with attributes and a menu text, and finally passed to the menuitem call in-place of the name value. The same process is required when setting the banner and menu attributes. A block is created as above, but this time the block id is passed to the body tag of the web page as follows: (menuSampleAtt1.rhtm) <rb:block rb:id="My Company Banner" width ="100%" bgcolor="EFA48D"><img src="logo web medium.gif"></rb:block> <rb:block rb:id="My Company Menu" bgcolor="EFA48D"></rb:block> <BODY rbtopbar = "My Company Banner" rbmenubar="My Company Menu"> </BODY> To create a web page having the content split-up into sections, the body text sections need to be encapsulated by Redbourne 'Section' macro tags. Any code not included between section tags will always be displayed. Once the sections have been created, then these areas will need to be wrapped by Redbourne 'Chapter' tags. These chapter tags are used to implictly manage the situation if a section called does not exist. In this case, the first section in the chapter will be displayed. The syntax for section is shown below: <rbm:chapter> Text which is always shown. <rbm:section name="part1"> <h1>Section Number One</h1> </rbm:section> <rbm:section name="part2"> <h1>Section Number Two</h1> </rbm:section> </rbm:chapter>
To initiate autogeneration of sub-menu items, include any combination of rbm:menuitem parameters in the chapter tag. Here, the autogenerated sections will 'hang-of' the parent 'Sections'. Inaddition, a href has been included to override the main level2 include file href link.
<rbm:chapter parent = "Sections" href = "menuSampleSectionsb.rhtm"> Text which is always shown. <rbm:section name="part1"> <h1>Section Number One</h1> </rbm:section> <rbm:section name="part2"> <h1>Section Number Two</h1> </rbm:section> </rbm:chapter>