ASP 高级模板引擎实现类(7)


        Execute "Text = " & id & "(1)"                                            ' 加载数据源
        Set Matches = GetMatch(Content, "\<Columns\>([\s\S]+)\<\/Columns\>")
        If Matches.Count > 0 Then
            For Each SubMatches In Matches
                SubText = ItemTemplate(SubMatches.SubMatches(0), Text, page, PageID)' 执行模块替换
                Content = Replace(Content, SubMatches.value, SubText, 1, -1, 1)
            Next
            DataBind = Content
        Else
            DataBind = ""
        End If
        Set Matches = Nothing
    End Function

    ' ***************************************
    '    匹配模板实例
    ' ***************************************
    Private Function ItemTemplate(ByVal TextTag, ByVal Text, ByVal page, ByVal PageID)
        Dim Matches, SubMatches, SubMatchText
        Dim SecMatch, SecSubMatch
        Dim i, TempText
        Dim TextLen, TextLeft, TextRight
        Set Matches = GetMatch(TextTag, "\<ItemTemplate\>([\s\S]+)\<\/ItemTemplate\>")
        If Matches.Count > 0 Then
            For Each SubMatches In Matches
                SubMatchText = SubMatches.SubMatches(0)
                ' ---------------------------------------------
                '    循环嵌套开始
                ' ---------------------------------------------

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2094.html