asp recursive 트리 구조
제목 : asp recursive 트리 구조
소스 :
<%
function fntree(parent, arrPages)
children = false
for x = 0 to ubound(arrPages, 2)
phone = ""
name = ""
if (arrPages(1, x) = parent) then
if (children = false AND parent > "0") then
children = true
Response.Write("<ul>")
end If
If arrPages(0,x) = "" Then
phone = ""
Else
phone = Left(arrPages(0,x), 3) & "****" & Right(arrPages(0,x), 4)
End If
If Len(arrPages(2,x)) > 2 Then
name = Left(arrPages(2,x), 1) & "*" & Mid(arrPages(2,x), 3, Len(arrPages(2,x)))
Else
name = ""
End If
%>
<li>
<%=phone%>, <%=name%>
<% Call fntree(arrPages(0,x), arrPages) %>
</li>
<%
end if
next
if (children = true AND parent > "0") then
Response.Write("</ul>")
end if
end function
'배열에 담길 값
'arrList == ID, PID, NAME
print "<ul>"
print "<li>" & authPartnerID & ", 나"
Call fntree(authPartnerID, arrList)
print "</li></ul>"
%>
내용 :
-나
ㄴ아들1
ㄴ손자1
ㄴ증손자1
ㄴ증손자2
ㄴ손자2
ㄴ아들2
를 표현할때 사용함.
예제 소스 파일 :
출처 :