多维数组的应用

<%
”失去的地平线后台导航参数设置
dim MainArray(2,4,1)
MainArray(0,0,0) = “KK_Index.asp”
MainArray(0,0,1) = “控制板”
MainArray(0,1,0) = “KK_Index.asp”
MainArray(0,1,1) = “站点信息”
MainArray(0,2,0) = “KK_Administrator.asp”
MainArray(0,2,1) = “管理员设置”
MainArray(0,3,0) = “KK_ManageRecords.asp”
MainArray(0,3,1) = “后台登录记录”
MainArray(1,0,0) = “KK_Content.asp”
MainArray(1,0,1) = “文章”
MainArray(1,1,0) = “KK_Content.asp”
MainArray(1,1,1) = “文章”
MainArray(1,2,0) = “KK_AddContent.asp”
MainArray(1,2,1) = “添加新文章”

失去的地平线后台参数获取
Dim GetSide,Side
GetSide = Request.ServerVariables(“SCRIPT_NAME”)
Side = Mid(GetSide,InStrRev(GetSide,”/”)+1)
for x = 0 to ubound(MainArray)
 for y = 1 to 4
  if Side = MainArray(x,y,0) then
   Main = MainArray(x,0,0)
  end if
 next
next
失去的地平线后台主导航参数
function MainNav(Main)
for x = 0 to ubound(MainArray)
 if Main = MainArray(x,0,0) then
  Response.Write “<li><a href=””” & MainArray(x,0,0) & “”” class=””active””>” & MainArray(x,0,1) & “</a></li>”  & vbcrlf
 Else
  Response.Write “<li><a href=””” & MainArray(x,0,0) & “””>” & MainArray(x,0,1) & “</a></li>”  & vbcrlf
 end if
next
end function
%>

调用:<% call MainNav(Main) %>

PS:这依旧是个失败的做法,虽然这个3维数组本身是没有什么错误的,最后觉得此类导航最实在的竟然是JS,之前竟然没有想到。

数组的应用

<%
”失去的地平线后台导航参数设置
MainArray = Array(“ControlPanel|控制板”,”Content|文章”,”SitePage|页面”,”Comments|评论”,”SiteUser|用户”,”SiteClass|外观”,”SiteSet|设置”)
ControlPanelArray = Array(“ControlPanel|控制板”,”Administrator|管理员设置”,”ManageRecords|后台登录记录”)

”失去的地平线后台参数获取
Main = Trim(Request.QueryString(“Main”))
if Main = “” then
 MainSubArray = Split(MainArray(0),”|”)
 Main = MainSubArray(0)
end if

失去的地平线后台主导航参数
function MainNav(Main)
for i = 0 to ubound(MainArray)
 MainSubArray = Split(MainArray(i),”|”)
 if Main = MainSubArray(0) then
  Response.Write “<li><a href=””KK_index.asp?Main=” & MainSubArray(0) & “”” class=””active””>” & MainSubArray(1) & “</a></li>”  & vbcrlf
 Else
  Response.Write “<li><a href=””KK_index.asp?Main=” & MainSubArray(0) & “””>” & MainSubArray(1) & “</a></li>”  & vbcrlf
 end if
next
end function
%>

调用:<% call MainNav(Main) %>

PS:简单一维数组的实例,后来却发现一维远远不够如此操作的。