Simple ASP Template 1.5 Demo

This very simple demo illustrates how to use the ASP Template class to separate code and content. The template file is striaghtforward:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


This is me after losing a bet...<br>
<a href=""><img src="[%images%]jqs.jpg" border="0"></a>

The token date is replaced by formatdatetime(now(), 3); the token title is replaced by ASP Templates [1.5] Simple; and, finally, the template images is replaced by /demos/asptemplates/templates/Simple/images/. The output can be seen below.

ASP Templates [1.5] Simple 1:04:35 AM

This is me after losing a bet...

Source Code

<!--#INCLUDE file="includes/template_cls.asp"-->
dim objTemplate
const TMPLDIR = "/demos/asptemplates/templates/Simple/tmpl/"
const IMGDIR = "/demos/asptemplates/templates/Simple/images/"
set objTemplate = new template_cls
with objTemplate
	.TemplateFile = TMPLDIR & "template.html"
	.AddToken "date", STRINGVARIABLE, formatdatetime(now(), 3)
	.AddToken "title", STRINGVARIABLE, "ASP Templates [1.5] Simple"
end with
set objTemplate = nothing

[View the complex.asp demo] | [View the ReallyComplex.asp demo] | [Return to the article]