Templates and Templating
A CrownPeak "template" uses a collection of template files to define the
input forms, preview and output views, and data processing for content stored in
the CMS. Template files are typically HTML files with embedded CMS and VBScript
code, but they can output other programming languages such as .NET, JSP and
PHP.
In addition to the input and output template files, CrownPeak CMS offers many
other template files to help provide hooks for custom functionality. These other
template files are documented in the Administrator Guide and Developer Guide,
and include the post_input.asp template (to provide field checking and
post-submit functionality for input forms), the preview.asp template file (to
provide a CMS-only streamlined version of the output.asp template file), and the
filename.asp and url.asp template files (to provide extended file renaming
support for publishing). Other template files cover the interface for
integrations with other systems like SMTP, FTP, ODBC etc.
Any code that is written in CrownPeak CMS lives in template files and uses
VBScript with many higher-level CMS functions. VBScript was chosen since it is
easy to learn, has widespread adoption, can be tested with no explicit
compilation, and has a nice sandbox component available so that multiple
developers on the same machine are protected from themselves.
The rest of the system administration is managed via the GUI interface, so
there are no configuration files needed.
Templates With CrownPeak CMS, the definition of a template is a collection
of template files that define the input form, the output forms, and optional
event specific code. Each template is represented as a folder within the system
since it may contain several template files.
Template Files Within a template, there are one or more template files.
Each contains HTML and CMS code to define the input forms for content, the final
output forms, and any event code needed to support the template. None of the
template files are required, and different types of templates may use different
template files. For example, a Press Release template might have both input and
output template files while the Press Release Index template would only have an
output template file since the input is all done at the Press Release level –
the Index is generated from a list of individual Press Releases. Of course, you
can also have mixed pages with some automatic content and some fielded content.
A good example is a typical Home Page template where the input template defines
a message of the day, while the rest of the page is drawn from recent additions
or slotted material from other parts of the CMS.
This example also highlights an important point – content is not limited to
one template. Templates can use content in any asset or folder, and assets can
be managed by several templates. Template files, then, are grouped by typical
page types, but many variations are possible.
There is a very large number of possible templates and template combinations
- here are a few examples of template files within the system. Note that most of
the following code was generated by the powerful code wizard right in the
developer environment.
|