Folders and Folder Lists

HTML templates

Basic information

An HTML template is a file containing valid HTML-code that Websydian Express uses to generate the web pages that are sent to the browser.

Each HTML template contains all of the static HTML code (the part of the HTML that does not change from request to request) for one web page - and a number of so-called replacement markers that are used to specify where request specific data will be inserted in the generated web page.

This document describes how Websydian Express handles the task of finding the templates and the options this provides for the user.

Presentations and file names

As mentioned above, the HTML templates are actually standard HTML files. This means that to be able to find the template, the Websydian Express runtime will have to know the file name and the path for the folder in which the file is stored.

This document will focus on determining the path to the folder. But before proceeding with this, a few facts about how to determine the file name:

So if the PageGenerator refers to a basic filename of ABC.htm and the presentation defines a suffix "_1", then the name of the file that the runtime will try to read is ABC_1.htm.

Folders

Basic information

Having all the templates files in one folder would be sufficient in some cases.

However, a web application will often use quite a lot of templates. This means that it is beneficial to be able to structure the storage of the templates. The logical way to do this is by storing different types of templates in different folders.

E.g. if you want to use several different versions of the same template - so that different users will see the same page in different ways. As the file name is used to identify the template, it is obvious that different versions of the same template can't be stored in the same folder in the file system.

This means that it is necessary for the runtime to be able to search for the template files in more than one folder, and thereby that it must be possible to define these folders in Websydian Express.

Physical folders and Websydian Express folders

You specify where the runtime is to be able to search for the template files by defining the physical folders as Websydian Express folders.

Using the term "folder" for specifying where to find the template files is probably a pretty obvious choice. Unfortunately, in this document this choice also offers an opportunity for confusion, as a folder in the file system and a Websydian Express folder is not quite the same thing.

To attempt to minimize this confusion, folders in the file system will be termed "physical folders" in the rest of this document.

The main information you must provide when you specify a Websydian Express folder is the path of the physical folder. This means that a Websydian Express folder can be seen as an "alias" for a physical folder.

However, when you define a Websydian Express folder, there are some other information you can provide that can have a significant impact on how the web page will be generated (see the section Resources for folders). This means that one physical folder can be referred by more than one Websydian Express folder.

Resources for folders

In addition to specifying the path of the physical folder, you can provide information about where resources (e.g. image files), stylesheet files, and JavaScript files can be found.

This provides the opportunity to have one physical folder containing HTML templates and for this define two Websydian Express folders using two different stylesheet files. One example for such a use could be if your application should fit into the Intranets of two different customers - and you want the application to look like the rest of the customers Intranet.

Administration interface

The Websydian Express folders are created and maintained using the menu item Templates→Folders in the administration interface.

Folder lists

Basic information

As described above, Websydian Express provides functionality for specifying several physical locations for your template files.

This is not sufficient in itself. Being able to specify more than one location for templates makes it necessary to be able to specify the order in which the folders must be accessed. This order is specified by creating a folder list, and attaching the folders you want to be able to access to this folder list.

You can define as many folder lists as you want to - and to each of these, you can attach as many folders as you want to.

Determine folder list for a session

The option to create several folder lists means that is is relevant to have a look at how the folder list is determined for a session.

A folder list can be assigned to a session, either by using a folder list specified for the user who have logged into the session or, if no user are logged in or the user have no folder list assigned, by using the roles assigned to the session.

Examples

During development

When you are developing you application, you will often have templates in different states. As an example, you could have the following:

1. The raw templates (as generated by the DocumentTemplateGenerators/PageModeler)

2. Unstyled templates with JavaScript applied

3. Styled templates

In this case you can create a Websydian Express folder for each of these template types, and create a folder list that has the styled templates as the first folder, the unstyled templates as the second folder and the raw templates as the last folder.

This will mean that you can test using the raw templates right away, and as the templates progress to having the JavaScript and styling applied, the new templates will automatically be used.

Using special styles for groups of users

This can be relevant if you for example have customers from several different companies, and for one or more of these companies want to use a special style (maybe just showing the company logo on all the  pages, maybe only showing certain information to special groups of customers, the options are almost limitless).

If the different styling can be expressed in the stylesheet used by the pages, you can do the following:

  1. Place all of your templates in a physical folder. In this example the folder is named Default.
  2. Place the templates that is influenced by the special style in another physical folder. In this example the folder is named Custom.
  3. Create a Websydian Express folder for the Default physical folder.
  4. Create a Websydian Express folder for each of the special styles. All of these must specify the path to the Custom physical folder and specify the stylesheet that defines the special style.
  5. For each special style create a folder list that has the folder containing the special templates first, and the Default folder second.
  6. For each special style, create a role that has the corresponding folder list assigned and specify this role for all of the users belonging to the company for which you want to use the special style.
    Alternatively assign the folder list directly to each user.

If the different styling demands changes to the templates (e.g. removal of fields for special groups of customers) - step one must just be expanded to having one physical folder for each special style.

Administration interface

The Folder Lists can be created and maintained using the menu item Templates→Folder Lists in the administration menu.

Performance considerations

The Websydian Express folder lists provide a highly flexible way to control how the templates are found. However, this comes with a certain overhead.

Everytime the runtime tries to access a template, it takes some time. This means that if a folder list is made containing a number of folders - and almost all of the templates are placed in the last folder - a measurable overhead occurs for each request.

This does not mean that you should only define one folder for each folder list. It just means that you should not overdo the number of folders in each list - and you should try to create a situation, where the most used templates can be found in the first folder in the folder list.

Related information

Change Theme
Administration guide showing how you can change the theme of the site.
Find Template
Administration guide showing how you can identify the template that has been used to generate a web page.
Users and Roles
Document describing the role based authorization system of Websydian Express - and how it relates to folder lists.
New Presentation
Developer Guide describing how to create a new presentation for a process.
HTML templates for RPG/2E
Document describing the use of HTML templates for RPG/2E developers.
Maintain Folders
Reference documentation for the folder maintenance.
Maintain Folder Lists
Reference documentation for the folder list maintenance.