Function getFileName()
Dim lsPath, arPath
'Obtain the virtual file path
lsPath = Request.ServerVariables("SCRIPT_NAME")
'Split the path along the /s. This creates a one-dimensional array
arPath = Split(lsPath, "/")
'The last item in the array contains the file name
getFileName = arPath(UBound(arPath,1))
End Function
Function eregi(ByVal str, ByVal patrn,ByVal rpl)
'EJ, para sacar tags eregi(texto,"<([^>]+)>","")
'Ej, para sacar los links eregi(texto,"<a([^>]+)>|</a>","")
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
StrReplace = regEx.Replace(str,rpl)
eregi = StrReplace
End function
' An inverse to Server.URLEncode
function URLDecode(str)
dim re
set re = new RegExp
str = Replace(str, "+", " ")
re.Pattern = "%([0-9a-fA-F]{2})"
re.Global = True
URLDecode = re.Replace(str, GetRef("URLDecodeHex"))
end function
' Replacement function for the above
function URLDecodeHex(match, hex_digits, pos, source)
URLDecodeHex = chr("&H" & hex_digits)
end function
function openDB()
dim conn
set conn = server.createobject("ADODB.Connection")
conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=;UID=;PWD=;DATABASE="
openDB = conn
end function
Dim sBgcolor
if (i mod 2 = 0) then
sBgcolor = "#eee"
else
sBgcolor = "#fff"
end if
<tr style="background-color:<%=sBgcolor%>;" onMouseOver="this.style.background='#ddd;'" onMouseOut="this.style.background='<%=sBgcolor%>;'">
sub getChildren(rowId)
Dim sSQL,oRS,itemArray,i
sSQL = "SELECT rowId,rowName,parent_id from table WHERE parent_id = " & rowId
set oRS = cn.execute(sSQL)
itemArray = oRS.getRows()
if isArray(itemArray) then
dim rowId,rowName,parent_id
for i = 0 to ubound(itemArray,2)
rowId = itemArray(0,i)
rowName = itemArray(1,i)
parent_id = itemArray(2,i)
call getChildren(parent_id) 'pass in parent id here
response.write " >> <a href=""page.asp?p="&rowId&""">"&rowName&"</a>"
next
end if
end sub