ASP Templates

As your sites (and scripts) become more complex you will find that templates will save you a great deal if time. Here is a small function to get you started.

Function htmltemp()
template = "<HTML>"
template = template & "<TITLE><!-title-></TITLE>"
template = template & "<BODY>"
template = template & "<!-body->"
template = template & "</BODY>"
template = template & "</HTML>"
htmltemp = template
End Function

Test out the function above by using it an ASP page. Below is a sample ASP page using the template function.

File: makepage.asp

<%@ LANGUAGE="VBSCRIPT" %>

<% thetitle = "HTML Template"
thebody = "<CENTER> This is the template! </CENTER>"

template = htmltemp()
template = Replace(template, "<!-title->", thetitle)
template = Replace(template, "<!-body->", thebody)
Response.Write template

Function htmltemp()
template = "<HTML>"
template = template & "<TITLE><!-title-></TITLE>"
template = template & "<BODY>"
template = template & "<!-body->"
template = template & "</BODY>"
template = template & "</HTML>"
htmltemp = template
End Function

%>