|
xxx
Utility Belt:
Table of Contents
by Charles Carroll
The code below shows "Utility Belt"
creating a Table of Contents for pages on a website from an XML File.
Explanation of HashTable used by the TOC facility.
| HashTable Key |
Description |
| TOC |
This is the URL where your
master TOC file lives. |
| group |
Element that groups section.
Title attribute is mandatory. |
| weblocation |
Element for 1 URL |
| webname |
Element for 1 URL Description |
/experiments/utilitybelt/data/books.xml is the data file.
Here is a page that needs prev/next
page links so just ties into the standard TOCBar facilities to get them.
Science Fiction Books
filename=/experiments/utilitybelt/vercurrent/ubdemo_tocbar_bookscifi.aspx
<%@ debug="true" %>
<%@ Assembly src="utilitybelt.vb" %>
<script language="VB" runat="server">
dim ub1 as new LearnAsp.utilitybelt()
Sub Page_Load(S As Object, E As EventArgs)
dim ht1 as new hashtable
ht1.add("weblocation","url")
ht1.add("webname","name")
ht1.add("toc","utilitybeltdemo_toc.aspx")
plcTOC.controls.add(new literalcontrol(ub1.TOCBar("/experiments/utilitybelt/data/books.xml",ht1)))
End Sub
</script>
<html><head>
<title></title>
</head>
<body bgcolor="#FFFFFF">
<asp:placeholder id="plcTOC" runat="server"/>
<Font size="+2">Science Fiction Books</font>
<form runat="server">
</form>
</body></html>
Fortean Books
filename=/experiments/utilitybelt/vercurrent/ubdemo_tocbar_bookfortean.aspx
<%@trace="false" debug="false" %>
<%@ Import Namespace="LearnAsp"%>
<%@ Assembly src="utilitybelt.vb" %>
<script language="VB" runat="server">
dim ub1 as new utilitybelt()
dim strConnect as string
Sub Page_Load(S As Object, E As EventArgs)
TRY
trace.tracemode=TraceMode.SortByTime
ub1.plcException=plcErr
dim ht1 as new hashtable
ht1.add("weblocation","url")
ht1.add("webname","name")
ht1.add("toc","utilitybeltdemo_toc.aspx")
plcTOC.controls.add(new literalcontrol(ub1.TOCBar("/experiments/utilitybelt/data/books.xml",ht1)))
CATCH exc as exception
ub1.ExceptionReportWithDetail("SUB Page_Load",exc,"no more details from me")
END TRY
End Sub
</script>
<html><head>
<title></title>
</head>
<body bgcolor="#FFFFFF">
<asp:placeholder id="plcErr" runat="server"/>
<asp:placeholder id="plcTOC" runat="server"/>
<Font size="+2">Fortean Books</font>
<form runat="server">
</form>
</body></html>
Modern Fiction Books
filename=/experiments/utilitybelt/vercurrent/ubdemo_tocbar_bookmodernfiction.aspx
<%@trace="false" debug="false" %>
<%@ Import Namespace="LearnAsp"%>
<%@ Assembly src="utilitybelt.vb" %>
<script language="VB" runat="server">
dim ub1 as new utilitybelt()
dim strConnect as string
Sub Page_Load(S As Object, E As EventArgs)
TRY
trace.tracemode=TraceMode.SortByTime
ub1.plcException=plcErr
dim ht1 as new hashtable
ht1.add("weblocation","url")
ht1.add("webname","name")
ht1.add("toc","utilitybeltdemo_toc.aspx")
plcTOC.controls.add(new literalcontrol(ub1.TOCBar("/experiments/utilitybelt/data/books.xml",ht1)))
CATCH exc as exception
ub1.ExceptionReportWithDetail("SUB Page_Load",exc,"no more details from me")
END TRY
End Sub
</script>
<html><head>
<title></title>
</head>
<body bgcolor="#FFFFFF">
<asp:placeholder id="plcErr" runat="server"/>
<asp:placeholder id="plcTOC" runat="server"/>
<Font size="+2">Modern Fiction Books</font>
<form runat="server">
</form>
</body></html>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|