ASP模板技术探讨之关联变量
ASP模板技术探讨之关联变量。
先看可实现的效果:
访问变量,需要与ASP结合
关联变量:支持关联的变量
{$#关联名#}
Assgin #关联名#,#变量#
{$#关联名#}
{$#关联名#.#索引#}
Assgin #关联名#,Array(“123″)
{$#关联名#.0}
{$#关联名#.#索引#.#索引#}
Assgin #关联名#,Array(Array(“123″))
{$#关联名#.0.0}
{$#关联名#.#索引#…..#索引#}
Assgin #关联名#,Array(Arr..ay(“123″)))
{$#关联名#.0…0}
{$#关联名#.#Directionary.Key#}
Assgin #关联名#,#DirectionaryName#
{$#关联名#.#Directionary.Key#}
<%
Dim outHtml
outHtml = "xxx" '加载模板
function Assign(t,n)
if isArray(n) then
for x=0 to ubound(n)
Assign t&"."&x,n(x)
next
elseif isobject(n) then
for each x in n
Assign t&"."&x,n.item(x)
next
else
if isnull(n) then
outHtml=replace(outHtml,"{$"&t&"}","")
else
outHtml=replace(outHtml,"{$"&t&"}",n)
end if
end if
end function
%>