// page information $page_type = "t"; $page_title = "ASP Templates"; $page_keywords = "asp, tutorial, templates, asp templates, html, code, scripts"; $page_description = "ASP templates tutorial. Find more tutorials and scripts at TheScripts.com, a programming and software development resource, directory and community."; $page_articletitle = "ASP Templates"; $page_next_url = ""; $page_next_anchor = ""; $page_prev_url = "/serversidescripting/asp/articles/page1.html"; $page_prev_anchor = "ASP Cookies"; $page_author = "Robert Murdock"; $page_byline = "Programmer, Darpac Inc."; // site header include ($_SERVER["DOCUMENT_ROOT"]."/header.php"); // begin html ?>
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
%>