Hi,

I want to store a site structure in pairs of ("Page Title", "URL") into an array that can be used then for generating navigation elements like menu, breadcrumbs, sitemap.

I allready use a dynamic pop menu script taken from a free scripts site that use the same format for this arrays.

The problem is that for some scripts I want to be able to parse this arrays easier, because the code I use now is somehow bulkier.

So either I store the values in a multidimensional array or I find a method to read sequentialy all arrays defined in a script. I couldn't find an arrays collection in VBScript, or somethin similar to document.forms[] in JavaScript.

I don't know how to get organized and use a multidimensional array for this, so maybe you have a better ideea of approaching this.



Code:
<%
'****************Breadcrumbs Builder + other navigation functions****************
'This script displays hierarchical site links allowing users 
'to know where they currently are and where they are in relation
'to the site's hierachy. Ex: Home > Products > Elecronics > HI-FI
'********************Author: ***********************************


'*******************************************Site stucture arrays >>
'Array_format: Page_level_child_child = Array("Page Title", "URL")
'allways use leading zeros for page index notations

Page_01 = Array("Unternehmen","load.asp?c=unternehmen/unternehmen.asp")
	
	Page_01_01 = Array("Portfolio","load.asp?c=unternehmen/portfolio.asp")
	Page_01_02 = Array("Management","load.asp?c=unternehmen/management.asp")
	Page_01_03 = Array("Jobs & Karriere","load.asp?c=unternehmen/jobs.asp")
	Page_01_04 = Array("Auszeichnungen","load.asp?c=unternehmen/auszeichnungen.asp")
	Page_01_05 = Array("Impressum","load.asp?c=unternehmen/impressum.asp")

Page_02 = Array("Lösungen","load.asp?c=loesungen/loesungen.asp")
	Page_02_01 = Array("Data Services","load.asp?c=loesungen/dataservices/data_services.asp")		
	Page_02_02 = Array("eCatalogs","load.asp?c=loesungen/ecatalogs/eCatalogs.asp")
		Page_02_02_01 = Array("tma-File","load.asp?c=loesungen/ecatalogs/tma-File.asp")
		Page_02_02_02 = Array("Distribution","load.asp?c=loesungen/ecatalogs/distribution.asp")
		Page_02_02_03 = Array("Catalog Download","load.asp?c=loesungen/ecatalogs/catalog_download.asp")
		Page_02_02_04 = Array("Kundenbedarf","load.asp?c=loesungen/ecatalogs/kundenbedarf.asp")
		Page_02_02_05 = Array("Fazit","load.asp?c=loesungen/ecatalogs/fazit.asp")
	Page_02_03 = Array("Medien","load.asp?c=loesungen/medien/medien.asp")
		Page_02_03_01 = Array("ITK-Handel","load.asp?c=loesungen/medien/itkhandel/itkhandel.asp")
			Page_02_03_01_01 = Array("Produkte","load.asp?c=loesungen/medien/itkhandel/produkte.asp")
			Page_02_03_01_02 = Array("Anmeldung","load.asp?c=loesungen/medien/itkhandel/anmeldung.asp")
		Page_02_03_02 = Array("Newsletter","load.asp?c=loesungen/medien/newsletter.asp")
		Page_02_03_03 = Array("Verbund-Mails","load.asp?c=loesungen/medien/verbundmails/verbundmails.asp")
			Page_02_03_03_01 = Array("Themen","load.asp?c=loesungen/medien/verbundmails/themen.asp")
			Page_02_03_03_02 = Array("Anmeldung","load.asp?c=loesungen/medien/verbundmails/anmeldung.asp")
		Page_02_03_04 = Array("Mediadaten","load.asp?c=loesungen/medien/mediadaten/mediadaten.asp")	
	Page_02_04 = Array("Info-Portale","load.asp?c=loesungen/infoportale/infoportale.asp")
		Page_02_04_01 = Array("WebTradeCenter","load.asp?c=loesungen/infoportale/wtc.asp")
		Page_02_04_02 = Array("Wide Area Infoboard","load.asp?c=loesungen/infoportale/wai.asp")
		
Page_03 = Array("Referenzen","load.asp?c=referenzen/referenzen.asp")
	Page_03_01 = Array("eCatalogs","load.asp?c=referenzen/eCatalogs.asp")
		Page_03_01_01 = Array("Portale","load.asp?c=referenzen/portale/portale.asp")
	Page_03_02 = Array("Data Services","load.asp?c=referenzen/data_services.asp")
	Page_03_03 = Array("Medien","load.asp?c=referenzen/medien.asp")
	Page_03_04 = Array("WebTradeCenter","load.asp?c=referenzen/wtc.asp")

Page_04 = Array("News & Events","/news/presse/gotoaktuell.htm")
	Page_04_01 = Array("Presse","/news/presse/gotoaktuell.htm")
		Page_04_01_01 = Array("Aktuell","load.asp?c=news/presse/aktuell.asp")
		Page_04_01_02 = Array("Archiv","load.asp?c=news/presse/archiv/archiv.asp")
		Page_04_01_03 = Array("Registrierung","load.asp?c=news/presse/registrierung.asp")
		Page_04_01_04 = Array("Kontakt","load.asp?c=news/presse/kontakt.asp")
	Page_04_02 = Array("Investor Relations","/news/ir/gotoirarchiv.htm")
		Page_04_02_01 = Array("Investor News","load.asp?c=news/ir/irarchiv.asp")
		Page_04_02_02 = Array("Corp. Governance","load.asp?c=news/ir/corp_gov.asp")
		Page_04_02_03 = Array("Finanzkalender","load.asp?c=news/ir/finanzkalender.asp")
		Page_04_02_04 = Array("IR-Publikationen","load.asp?c=news/ir/irpublik.asp")
		Page_04_02_05 = Array("Hauptversammlung","load.asp?c=news/ir/hauptversammlung2004/hauptversammlung_2004.asp")
		Page_04_02_06 = Array("Going Public","load.asp?c=news/ir/goingpublic.asp")
		Page_04_02_07 = Array("Kontakt","load.asp?c=news/ir/kontakt.asp")
	Page_04_03 = Array("Events","load.asp?c=news/events/events.asp")
		Page_04_03_01 = Array("Messen & Kongresse","load.asp?c=news/events/messen.asp")
	Page_04_04 = Array("Newsletter-Archiv","load.asp?c=news/newsletter_archiv.asp")

Page_05 = Array("Kontakt","load.asp?c=kontakt/kontakt.asp")

'current URL
Dim urlu
urlu = Request.ServerVariables("SCRIPT_NAME") & "?" & Request.ServerVariables("QUERY_STRING")

Dim pgtitle

'*************************************************Breadcrumbs generation >>
Function BuildCrumb(pg)

	'determine current page level (count "_" occurences in passed pg string Ex: "Page_4_2_9")
	pg_level = 0
	For i=1 To Len(pg)
		If InStr(Mid(pg,i,1), "_") <> 0 Then
		pg_level = pg_level + 1
		End If 
	Next
	
	separator = " &gt; "
	Response.Write("<a href='/'>Home</a>")
	Dim crumb(10) 'if you'll have more than 10 elements in the breadcrumb enter a new value for Crumb array dimension
	For i=1 To pg_level - 1 'Is (pg_level - 1) because we build last crumb separately without link on it
		crumb(i-1) = Left(pg, 4+3*i)
		
		If urlu = "/" & Eval(crumb(i-1))(1) Then
			pgtitle = Eval(crumb(i-1))(0)
			Response.Write(separator & "<span class='orange'>" & pgtitle & "</span>")	
		Else	
			Response.Write(separator & "<a href=" & Eval(crumb(i-1))(1) & ">" & Eval(crumb(i-1))(0) & "</a>")
		End If
			
	Next
		Response.Write(separator & "<span class='orange'>" & Eval(pg)(0) & "</span>")
		'Response.Write(" : ")
	
End Function

'Sample usage:
'BuildCrumb("Page_01_02_01")

'*************************************************SUBMENU GENERATION >>
Function BuildSubmenu(CurrPage, SubItemsCount)
	Response.Write("<b>")
	Response.Write("<span class='orange'>Weitere Informationen:</span><br>")
	For i=1 To SubItemsCount
		If i<=9 Then
			n = "_0" & i
		Else
			n = "_" & i
		End If
		If "/" & Eval(CurrPage & n)(1) = urlu Then
		pgtitle = Eval(CurrPage & n)(0)
		'Response.Write("<span class='orange'>" & pgtitle & "</span>&nbsp;&nbsp;&nbsp;")
		Else
		'Response.Write("<a href=" & Eval(CurrPage & n)(1) & ">" & Eval(CurrPage & n)(0) & "</a>&nbsp;&nbsp;&nbsp;")
		Response.Write("<img src='/images/pointer.gif' width='12' height='13' border='0'><a href=" & Eval(CurrPage & n)(1) & ">" & Eval(CurrPage & n)(0) & "</a><br>")
		End If
		'break row after 6 titles
		'If i=6 Then Response.Write("<br>") End If
	Next
		Response.Write("</b>")
End Function

'Sample usage:
'BuildSubmenu "Page_01",8



'*************************************************PAGE TITLE IN HEADER - GENERATION >>

'UGLY arrays reassignment (I couldn't find in a short time a better way to parse the values)
'To cancel a value (P(5) for example) write : P(5) = Array("","")
Dim P(57)
P(1) = Page_01
P(2) = 		Page_01_01
P(3) = 		Page_01_02
P(4) = 		Page_01_03
P(5) = 		Page_01_04
P(6) = 		Page_01_05
P(7) = 		Array("","")

P(8) = Page_02
P(9) =	Page_02_01
P(10) =		Page_02_02
P(11) =			Page_02_02_01
P(12) =			Page_02_02_02
P(13) =			Page_02_02_03
P(14) =			Page_02_02_04
P(15) =			Page_02_02_05
P(16) =		Page_02_03
P(17) =			Page_02_03_01
P(18) =				Page_02_03_01_01
P(19) =				Page_02_03_01_02
P(20) =			Page_02_03_02
P(21) =			Page_02_03_03
P(22) =				Page_02_03_03_01
P(23) =				Page_02_03_03_02
P(24) =			Array("","")
P(25) =		Page_02_04
P(26) =			Page_02_04_01
P(27) =			Page_02_04_02			

P(28) =Page_03
P(29) =		Page_03_01
P(30) =		Page_03_02
P(31) =		Page_03_03
P(32) =		Page_03_04

P(33) =Page_04
P(34) =	Page_04_01
P(35) =		Page_04_01_01
P(36) =		Page_04_01_02
P(37) =			Array("","")
P(38) =		Page_04_01_03
P(39) =		Page_04_01_04
P(40) =		Array("","")
P(41) =	Page_04_02
P(42) =		Page_04_02_01
P(43) =		Page_04_02_02
P(44) =		Page_04_02_03
P(45) =		Page_04_02_04
P(46) =		Page_04_02_05
P(47) =		Page_04_02_06
P(48) =		Page_04_02_07
P(49) =		Array("","")
P(50) =		Array("","")
P(51) =	Page_04_03
P(52) =		Page_04_03_01
P(53) =	Page_04_04

P(54) =Page_05
'added >>
P(55) = Page_03_01_01
P(56) = Array("Sitemap","load.asp?c=sitemap.asp")
P(57) = Page_02_03_04

Function DisplayPageTitle
	For i=1 To 57
		If "/" & Eval(P(i))(1) = urlu Then 
		pgtitle = Eval(P(i))(0)
	End If
	Next
	'customisation for Presse Releases
	If InStr(urlu, "/load.asp?c=news/presse/archiv/") <> 0 And urlu <> "/load.asp?c=news/presse/archiv/archiv.asp" Then
	pgtitle = "Pressemitteilung"
	End If
	Response.Write pgtitle
End Function
%>