acs-templating
.
The template system is designed to be used by two classes of users: programmers and designers. In bulding a web site, programmers are generally responsible for defining and implementing the application logic of the site, while designers are more responsible for the presentation. Generally speaking, the application logic generates data for the presentation to display to the user. The template system must provide mechanisms that supports both of these tasks and allows the designer and programmer to work seperately, but for their work to be combined at runtime into something that the user sees as a single page.
Thus, pages are naturally split into two parts. The logic part executes application logic and generates data, and the presentation part that specifies the layout of the page and so on.
What is needed is:
Jane Programmer writes a page contract and a draft template, that uses the promised page properties. Joe Designer takes that template and makes it look nice, using his design skills and HTML literacy. Meanwhile Jane Programmer writes code to generate the page properties, typically by querying the database. When both are done, the page is ready for Jim User, who requests it using his web browser.
Alternate scenario: Judy Designer is familiar with the template system. She starts directly from a defined page contract, so Jane Programmer doesn't need to write the draft template.
Programmers and designers should only have to learn a single system that serves as a UI substrate for all the functionally specific modules in the toolkit.
The system should not make any assumptions about how pages should look or function.
10.0.5Publishers should be able to change the default presentation of any module using a single methodology with minimal exposure to code.
It must be easy to use/integrate the templating system with any application. This implies a stable, simple, and comprehensive API for programmers to use when writing or converting modules.
Programmers must be able to publish a page's data sources, so that a graphic designer knows what data sources are available.
10.5.2 Page Contract ImplementationProgrammers must be able to generate and populate the page properties they promise. This includes page properties of types: onevalue, onerow, multirow, onelist, and multilist.
It must be simple for graphic designers to create and maintain templates that include dynamic data, and other templates. This requires a stable, simple, and comprehensive API for graphic designers to use when creating the layout pages for a site.
Much like the "mail merge" feature of a word processor, template authors must use special tags to position each piece of dynamic data within the layout. Each template is associated with a data dictionary that lists all available variables.
10.10.2 Use of ComponentsTo speed development and ensure consistency of design, template authors are encouraged to assemble pages from distinct component templates that may be recycled in different contexts. One typical practice is to build a "master" template for an entire section of a site, with a common header, footer and sidebar layout. For each page request, the "content" template is incorporated dynamically into a specified area of the master template, usually a table cell.
Another common practice is to build small reusable templates that may be included in other templates as logical components. This may be useful for common "widgets" such as search boxes or lists of related links, as well as for building configurable portal pages where users may assemble different types of content to their liking.
10.10.3 Inter-Template CommunicationTemplate authors need a simple mechanism for declaring properties within templates. The most common use of such properties is for configuring elements of an enclosing master template, such as the title, navigation links, and whether to include a search box.
10.10.4 Conditional InsertionDesigners often need to tailor the layout depending on the specific data being presented. For example, when presenting a list of library books that a user has checked out, the designer might want to highlight the overdue ones in red. For this, designers must have the ability to write simple program logic (Note: We run the risk of inventing our own language here, we must be careful).
Dynamic pages often present lists of values or records, each of which typically represents the results of a database query. Template authors must have a way to iterate over each value or record in such a list and format it appropriately. In the simplest scenario, the exact HTML is repeated with each iteration. However, template authors often need to vary the design depending on the context.
Programmers should be able to specify the page properties independently of the markup used to present the data in the template. Markup authors should be to able to write templates that reference the page properties without further intervention from the programmer to produce a finished page.
A graphic designer must be able to look at the documentation for a page in a documentation browser and find out what properties a page publishes and what types they are. This documentation should be available through the standard ACS documentation facilities.
There should be provisions so that pages can be broken into discrete components to simplify maintenance of the markup code and allow for reuse in different contexts. Examples of common page components include a navigation bar, a search box, or a section of a report or story.
There should be a way to define one or more standard master templates used by most pages on a site, so that changes to the overall look and feel of a site can be made in one place.
Given that the same data may be presented in many different ways, there should be a general mechanism for selecting a specific presentation (including file format, layout, character set and language) for each page request, depending on characteristics such as user preference, location, browser type and/or device.
Programmers should be able to develop template specifications using their standard tools for writing and maintaining code on the server. HTML authors should be able to access information about template specifications and work on templates remotely without needing shell access to the server.
The Templating System must be releasable as part of the ACS and as
a separate product. When distributed as part of the ACS all
documentation, examples, and source code must follow ACS
standards. This includes but is not limited to: using the
db_api
, using ad_page_contract
appropriately.
The Templating System must not cause any performance problems to a site. It must be fast and efficient, and it must not slow down page load speed by more than 10% versus a Tcl page with inline HTML.
Document Revision # | Action Taken, Notes | When? | By Whom? |
---|---|---|---|
0.1 | Creation | 8/23/2000 | Yonatan Feldman |
0.2 | Merge with previous docs | 8/25/2000 | Christian Brechbühler |
0.3 | Edited, reviewed, pending freeze | 8/28/2000 | Kai Wu |