ASP driven HTML outlines

Source: Internet
Author: User
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 1

The 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 indentfor indent = 1 to oindentresponse. write "<ol type =" "& otype &" Start = "& ostart &"> "& vbcrlfnextend sub

A "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>" & vbcrlfend sub

The outlinephrase sub wraps the phrase with the LIST command and writes it to the user's browser.

 
Outlinefoot 1

The 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 indentfor indent = 1 to oindentresponse. Write "</OL>" & vbcrlfnextend sub

When 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 "", 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 "", outlinephrase "d test outline" outlinephrase "E test outline" outlinefoot 2 outlinehead "1", outlinephrase "1 test outline" outlinephrase "2 test outline" Limit 3 outlinehead "", outlinephrase "A test outline" outlinephrase "B test outline" outlinefoot 4 outlinehead "I", outlinephrase "I test outline" outlinephrase "II test outline" limit 5 outlinehead "", 3, 4 outlinephrase "C test outline" outlinephrase "d test outline" outlinefoot 4

Outlinehead, outlinephrase, outlinefoot example:

    1. I test outline
      1. A test outline
      2. B test outline
      3. C test outline
        1. 1 test outline
        2. 2 test outline
        3. 3 test outline
      1. D test outline
      2. E test outline
        1. 1 test outline
        2. 2 test outline
          1. A test outline
          2. B test outline
            1. I test outline
            2. II test outline
          1. C test outline
          2. D test outline

The one sub outline procedure takes 5 arguments:

 
Outline "A test outline", "A", 1, 2

The phrase, the type, the start, and the indent level.

 
Sub outline (ophrase, otype, ostart, oindent) dim indentfor indent = 1 to oindentresponse. write "<ol type =" & otype & "Start =" & ostart & ">" & vbcrlfnextresponse. write "<li>" & ophrase & "</LI>" & vbcrlffor indent = 1 to oindentresponse. write "</OL>" & vbcrlfnextend sub

This 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", outline "A test outline", "A", outline "B test outline ", "A", outline "C test outline", "A", outline "1 test outline", "1", outline "2 test outline", "1 ", outline "3 test outline", "1", outline "d test outline", "A", outline "1 test outline", "1 ", outline "2 test outline", "1", outline "A test outline", "A", outline "B test outline", "", 2, 4, outline "3 test outline", "1", 3, 3, outline "E test outline", "A", 5, 2, outline "<B> II test outline </B> ", "I", outline "A test outline", "A", outline "B test outline", "",

Outline sub example:

    1. I test outline
      1. A test outline
      1. B test outline
      1. C test outline
        1. 1 test outline
        1. 2 test outline
        1. 3 test outline
      1. D test outline
        1. 1 test outline
        1. 2 test outline
          1. A test outline
          1. B test outline
        1. 3 test outline
      1. E test outline
    1. II test outline
      1. A test outline
      1. B test outline

For your cutting and pasting pleasure, the entire VBScript funase looks like this. (put them in an Include File please. Don't let me catch you pasting this on multiple pages !!

  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.