O4W Templates

I. O4W Templates

All the O4W wizard routines(O4W Forms, O4W Reports, O4W Dashboards, etc.), as well as the O4W APIs, allow the developer to specify one or more "templates" on which their output can be displayed.  A template contains all the additional html elements needed to generate the full web page that a browser can display.  This includes images, colors, and style elements that both surround, and may be used by, the O4W routine's output.

By using a template that provides a professional and consistent look to the O4W web pages, developers can tie their O4W output into the rest of their web site.

A template is a text document, stored either in an operating system directory or an OpenInsight table, that contains all the html needed to display web output.  It can be created through any number of tools, by any member of the organization, though often companies will have on staff (or contract with) web developers whose job it is to create these pages using commercial products like Adobe Dreamweaver.

To create a template, it is usually best to start with a full web page, complete with all the images, links, and styles that you wish to see on your O4W output.  This document can then be edited (using for example Windows notepad) to add the particular elements that O4w requires.

If the html is taken from a full web page, you may find that some content and some dynamic elements and scripts will not be applicable to the O4W output, so they may be removed. _What_, exactly, is removed, and how much, and what remains, is a design decision that will vary with each template.

II. O4W Tags

O4W uses special tags that are added to the "plain" html document.  These tags indicate where the main dynamic content, the headers, the menus, etc. should be inserted.  The tags that O4W supports include:

O4W Templates - the location for the html title (in the <header> section)
%BODY% - the location for the main dynamic content
(c) 2023 Revelation Software, Inc. All Rights Reserved - the location for any footer
, , , - the location for the menu.  When specified as , the type of menu to use is derived from the O4W Configuration setting for "default menu direction".  If specified as , a horizontal menu is used; if is specified, a vertical menu is used.   forces the use of a 'tree' menu
%MENU-NONE% - prevents the use of any menu (useful for mobile templates)

The O4W Templates tag is placed in the <head> of the html document; it replaces (at least) the <title> tag and its contents.

Determining the proper location for the %BODY% tag (the most important O4W tag) may take some trial and error; in general, it should be centrally located to the page, and be able to dynamically shrink and grow (and have the other elements of the web page shrink and grow around it).  The tag (or its variants) may go in a different section of the html, or directly before the %BODY%.  The (c) 2023 Revelation Software, Inc. All Rights Reserved tag can be placed directly after the %BODY%, or in another html section as well.

Note that O4W will generate its own html "form" tags, so no O4W tags should be located within an html "form". However, the %BODY% and (c) 2023 Revelation Software, Inc. All Rights Reserved (and any tags) _should_ be located within an existing html "body" tag.

III. O4W Template Settings

Once the html document has been modified to include the O4W tags, it must be placed in the appropriate location for O4W use.  When using the O4W APIs, the template document can be located in any operating system folder by specifying the full path to the document; the template can also be placed in any OpenInsight table, by specifying the template name as "<tablename> <templateID>" (for example, "SYSLISTS THISTEMPLATE").  When using the O4W wizard tools, the template should be placed in the "template directory" location defined in the O4W Configuration table. The O4W Configuration record defines not only the location itself, but also the type of template location (either operating system folder or OpenInsight table).  By default, the template directory is the folder named "templates" under the O4W directory, located in the OpenInsight folder (and the type of template location is "operating system folder").

By placing your template in the correct directory, it will be available to select during the O4W wizard definition processes.

During the O4W wizard definition processes, it is also possible to select the "default" template.  The specification of which template should be used as the default is also done via an O4W Configuration record.

IV. Additional Templates

If O4W determines that a request is coming from a mobile browser, it will search for a "mobile-ready" version of the previously specified template.  This mobile-ready version may use fewer images, have smaller borders, etc.  For O4W to find this template automatically, it needs to be named "m_<templatename>" in the same location as the regular template (for example, if a template named "abc_co.html" is located in the O4W\templates directory, the mobile version should be named "m_abc_co.html" in the same directory).

During the O4W Report definition process, you are able to define an additional template to use if the specified report is invoked as a "popup".  Since an on-screen popup has less available screen space, and is not truly designed as a 'stand-alone' web page, you may wish to define a template with fewer (or no) images, etc., in this case.  Note that a template named "blank", containing no formatting and only the minimal O4W tags, is available for these (or other) situations.