Hi
I usually simplyify this by surrounding the HTML "placeholders" with
the hash character:
- - -
Thank you for purchasing #PolicyType# from our website
- - -
Then I loop through the fields in the recordset and do the
replacement:
- - -
For Each str_ItemFound In obj_RecordSet1.Fields
str_Value = obj_RecordSet1(str_ItemFound.Name)
If IsNull(str_Value) Then str_Value = ""
Select Case str_ItemFound.Name
Case "Premium"
str_Value = FormatCurrency(str_Value)
End Select
str_Contents = Replace(str_Contents,"#" & str_ItemFound.Name &
"#",str_Value)
Next
- - -
Seems to be fairly efficient as long as you are not handling masses of
data
MK
"Serge" <mb*@km.ru> wrote in message news:<up**************@TK2MSFTNGP12.phx.gbl>...
Is this affective way using HTML Templates in ASP:
i have html template file with <<TAG1>> .. <<TAGN>> in places, where i want
to insert some data
then i generate this data in asp
Dim d ' Create a variable.
Set d = CreateObject("Scripting.Dictionary")
d.Add "TAG1", "Athens" ' Add some keys and items.
d.Add "TAG2", "Belgrade"
d.Add "TAG3", "Cairo"
, open html template, replace each <<TAGx>> with generated data
(d.Item("TAGx") ),
and print it with Response.Write
Or there is any other usual methods to use templates?