470,591 Members | 2,126 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

HTML Page Templates in ASP

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?
Jul 19 '05 #1
1 1768
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?

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Dave Smithz | last post: by
13 posts views Thread by Michele Simionato | last post: by
19 posts views Thread by Logix | last post: by
3 posts views Thread by mark wade | last post: by
13 posts views Thread by David | last post: by
11 posts views Thread by David Schwartz | last post: by
15 posts views Thread by lxyone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.