ASP Driven HTML Outlines
By Nannette Thacker - 08/13/1999
Have you ever wanted to create a web page in outline form? Here's how, using ASP Driven HTML and the Ordered List, <OL> command.
I have created two forms of outline sub procedures. The first I'll describe allows you to send a set of lines in the same outline level, without putting extra space between the lines. It consists of using three sub procedures. The second method uses only one sub procedure, but uses the equivalent of a paragraph space throughout all the lines.
Let's review the first method. There are three sub procedures for the outline: OutlineHead, OutlinePhrase, and OutlineFoot. If you're not a fast typist, you may wish to change the names to something shorter.
Here is how to use the three subs:
OutlineHead "I",1,1 OutlinePhrase "<B>I Test Outline</B>" OutlineFoot 1The OutlineHead sub takes three arguments: the type, the start, and the indent level. These commands are used as follows:
sub OutlineHead(otype,ostart,oindent) dim indent for indent = 1 to oindent Response.Write "<OL TYPE=""" & otype & """ START=" & ostart & ">" & vbCrLf next end subA "for" loop is used to repeat the OL command for the number of indents needed. The "type" is used in the OL command to indicate the TYPE. Valid TYPE values are:
I, A, 1, a, and i
This indicates which outline type to use.
The "start" variable is used within the OL command to indicate the starting point. It takes a numeric value. If you want the outline level to start with I,A,1,a, or i, set the value to 1. If you want the outline level to start with III,C,3,c, or iii, set the value to 3, and so on.
The OutlinePhrase sub takes one parameter: the verbiage to display. You may optionally include HTML commands within this phrase.
sub OutlinePhrase(ophrase) Response.Write "<LI>" & ophrase & "</LI>" & vbCrLf end subThe OutlinePhrase sub wraps the phrase with the List command and writes it to the user's browser.
OutlineFoot 1The OutlineFoot sub takes one parameter, the indent level. It uses a "for loop" to repeat the ending Ordered List command in order to exit the number of indent levels.
sub OutlineFoot(oindent) dim indent for indent = 1 to oindent Response.Write "</OL>" & vbCrLf next end subWhen creating a group of lines within the same indent level, simply repeat the OutlinePhrase sub for as many lines are in the same level. The example code below was used to display the outline shown next:
OutlineHead "I",1,1 OutlinePhrase "<B>I Test Outline</B>" OutlineFoot 1 OutlineHead "A",1,2 OutlinePhrase "A Test Outline" OutlinePhrase "B Test Outline" OutlinePhrase "C Test Outline" OutlineFoot 2 OutlineHead "1",1,3 OutlinePhrase "1 Test Outline" OutlinePhrase "2 Test Outline" OutlinePhrase "3 Test Outline" OutlineFoot 3 OutlineHead "A",4,2 OutlinePhrase "D Test Outline" OutlinePhrase "E Test Outline" OutlineFoot 2 OutlineHead "1",1,3 OutlinePhrase "1 Test Outline" OutlinePhrase "2 Test Outline" OutlineFoot 3 OutlineHead "a",1,4 OutlinePhrase "a Test Outline" OutlinePhrase "b Test Outline" OutlineFoot 4 OutlineHead "i",1,5 OutlinePhrase "i Test Outline" OutlinePhrase "ii Test Outline" OutlineFoot 5 OutlineHead "a",3,4 OutlinePhrase "c Test Outline" OutlinePhrase "d Test Outline" OutlineFoot 4OutlineHead, OutlinePhrase, OutlineFoot example:
- I Test Outline
- A Test Outline
- B Test Outline
- C Test Outline
- 1 Test Outline
- 2 Test Outline
- 3 Test Outline
- D Test Outline
- E Test Outline
- 1 Test Outline
- 2 Test Outline
- a Test Outline
- b Test Outline
- i Test Outline
- ii Test Outline
- c Test Outline
- d Test Outline
Outline "A Test Outline","A",1,2The phrase, the TYPE, the START, and the indent level.
sub Outline(ophrase,otype,ostart,oindent) dim indent for indent = 1 to oindent Response.Write "<OL TYPE=""" & otype & """ START=" & ostart & ">" & vbCrLf next Response.Write "<LI>" & ophrase & "</LI>" & vbCrLf for indent = 1 to oindent Response.Write "</OL>" & vbCrLf next end subThis is the easiest outline to implement, but it creates the paragraph space between all lines.
The code below was used to create the outline example below:
Outline "<B>I Test Outline</B>","I",1,1 Outline "A Test Outline","A",1,2 Outline "B Test Outline","A",2,2 Outline "C Test Outline","A",3,2 Outline "1 Test Outline","1",1,3 Outline "2 Test Outline","1",2,3 Outline "3 Test Outline","1",3,3 Outline "D Test Outline","A",4,2 Outline "1 Test Outline","1",1,3 Outline "2 Test Outline","1",2,3 Outline "a Test Outline","a",1,4 Outline "b Test Outline","a",2,4 Outline "3 Test Outline","1",3,3 Outline "E Test Outline","A",5,2 Outline "<B>II Test Outline</B>","I",2,1 Outline "A Test Outline","A",1,2 Outline "B Test Outline","A",2,2Outline sub example:
- I Test Outline
- A Test Outline
- B Test Outline
- C Test Outline
- 1 Test Outline
- 2 Test Outline
- 3 Test Outline
- D Test Outline
- 1 Test Outline
- 2 Test Outline
- a Test Outline
- b Test Outline
- 3 Test Outline
- E Test Outline
- II Test Outline
- A Test Outline
- B Test Outline
<SCRIPT LANGUAGE=VBScript RUNAT=Server> sub Outline(ophrase,otype,ostart,oindent) dim indent for indent = 1 to oindent Response.Write "<OL TYPE=""" & otype & """ START=" & ostart & ">" & vbCrLf next Response.Write "<LI>" & ophrase & "</LI>" & vbCrLf for indent = 1 to oindent Response.Write "</OL>" & vbCrLf next end sub sub OutlineHead(otype,ostart,oindent) dim indent for indent = 1 to oindent Response.Write "<OL TYPE=""" & otype & """ START=" & ostart & ">" & vbCrLf next end sub sub OutlinePhrase(ophrase) Response.Write "<LI>" & ophrase & "</LI>" & vbCrLf end sub sub OutlineFoot(oindent) dim indent for indent = 1 to oindent Response.Write "</OL>" & vbCrLf next end sub </script>