This section describes the page layout template file in ASP script to be used as an include file for the main ASP script page.
In order for hyBook to be integrated into different Web sites, where each of them may have different
page layouts, I have designed the hyBook page to be based on a template include files. Here is how this design works.
1. Each ASP page will have a template include file inserted at the beginning.
2. The template include file provides code to control the page layout.
3. The page layout should have blank blocks where some ASP function calls will be placed.
4. Each ASP page should only implement those ASP functions called by the template.
For example, the following is a template include file in my hyBook demonstration package:
<%
opening
%>
<?xml version="1.0"?>
<html><head>
<title>hyBook - Demo</title>
<meta name="description" content="Demonstration page of hyBook
- A simple guest book script"/>
<meta name="keywords" content="hyBook, Guestbook, ASP">
<link rel="stylesheet" type="text/css" href="hyBook.css"/>
</head><body>
<center>
<%
outputHeader
%>
<!-- Other HTML or ASP codes -->
<%
outputBody
%>
<!-- Other HTML or ASP codes -->
<%
outputFooter
%>
<p>Powered by <a href=http://www.herongyang.com/hyBook/>hyBook</a></p>
</center>
</body></html>
<%
closing
%>
Note that there are 5 ASP function calls placed in this template:
"opening" - Giving the ASP page a chance to do initialization work, like establishing
database connection, and checking input data in the HTTP request.
"opening" - Giving the ASP page a chance to do closing up work, like closing
database connection.
"outputHeader" - Allowing the ASP page to generate HTML code designed as the header block.
"outputBody" - Allowing the ASP page to generate HTML code designed as the body block.
"outputFooter" - Allowing the ASP page to generate HTML code designed as the footer block.
What goes into the header block, the body block, and the footer block is up to the author of the page.
Of course, if you don't use any of those blocks, just implement an empty function in the ASP page.
Also note that a CSS file, hyBook.css, is designed in hyBook to allow you to control the appearance of individual HTML
elements.