SportPage templates are implemented in the Jakarta Velocity template system; before you read this section, you should read the Velocity User Guide to better understand the terminology and the Velocity VTL syntax.
SportPage uses Velocity variables to define page components common to most webpage design. By defining an overall layout and the placement of the header, menu, content page and sidebars within it, the website achieves the necessary consistency for good design while preserving and conserving (expensive) designer effort. As will be explained later, SportPage allows the designer to swap in different components depending on the context of the request, for example to give different topic areas context-specific menus, sidebars or content page layout.
![]() | Rule #1: Software Should Serve People |
---|---|
It is important that software serve the people who use it, not the other way around. It is more important to satisfy the process requirements of the website designers than to satisfy server or security ideals and it is best to consider the entire gestalt of the software ecology. Engineering is about solving problems, not imposing new ones. |
![]() | Caution |
---|---|
If you put the templates outside of the server document tree (e.g. in /sites/cbc.ca/templates/olympics) the Tomcat and Apache servers won't be able to access them. The problem for designers will be that the templates and the images they use will be in different places because the images must be accessible to either tomcat or apache. |
![]() | Servlets, Apache and Static Content |
---|---|
By default, and this varies from platform to platform, Apache will not allow servlets to serve static HTML content, specifically URI requests ending in .html. This is a problem if your templates or your default content (extra path information) ends with that suffix: This is one very strong technical reason why all internal links should never include these extensions. Unfortunately, the Apache server does not impose this same rule on static images: To accommodate this, SportPage is equipped to handle *.gif and *.jpg files found relative to the servlet home #include ("bio/header.html") would mean the template at /sites/cbc.ca/olympics/bio/header.vm whereas <a href="bio/bio.html"><img src="bio/bio.gif"></a> expects to find the servlet-home relative file path /sites/cbc.ca/site/webapps/template/bio/bio.gif but will create a link that will return the Apache DOCUMENT_ROOT relative file /sites/cbc.ca/site/docs/bio/bio.html |
![]() | Note |
---|---|
All page component filenames and directory paths are completely arbitrary. There is no reason why you couldn't assign these layout components to file paths divided by developer (default.layout=/jones/crusher.vm) or any other structure; all that matters is that the default set define template filenames, and that those files exist and are readable by the server before the SportPage system is started. Also note that only the default.layout variable name is required All the other page component names can be anything you wish, in any language (supported by the file-system) providing the variable names match the names used in the default layout file. For example, you could define default.centerstage=/sponsor/molsons.html and then place #parse( $centerstage ) into the center of your main content area. |
![]() | Warning |
---|---|
Velocity macros are not reloaded when the template pages change (they can be, but it's too expensive to be practical). Do not include in-line or library macros until you are certain they work; changes to these macros will require a servlet container restart. |