Customizing Templates

One main advantage when using a CMS is that you can seperate content from layout.
In OpenWebCMS? your editors enter content with content documents, and you can create your own subforms to provider your editors with a custom form.

Then you use one or more templates to define how a content should be displayed in the web.
In the template you define which stylesheet(s) to use, which JavaScript? ressources to include and what HTML/JavaScript? should be generated.

Background

When a content is requested by the browser, the following happens:

  • The systems gets the notes document the requested content.
  • The system looks in the notes document in the field 'templateID' for the UNID of the template document the content should be displayed with.
  • OR: the system looks for the template= URL parameter and takes the name of the template to use from there.
  • The system gets the template document.
  • The system looks which stylesheets to include and writes proper stylesheet-tags.
  • The system looks which JavaScript? ressources to include and write the proper script-tags.
  • The system evaluates the content of the preDML field of the template against the content document and writes the result.
  • The system writes the content of the RichText? field 'RT' from the content document.
  • The system evaluates the content of the postDML field fo the template against the content document and writes the result.

    In summary that means you define with a template:

  • Which stylesheets to include.
  • Which javascript ressources to include.
  • Addional text for the header and body tag
  • what should be written in front of the 'RT' field
  • what should be written after the 'RT' field.

    'RT' field means: in each content document there is a RichText? field named 'RT' in which editors put in their content.

    Field reference


    Namea speaking name for the template.
    StylesheetYou can include one or more stylesheet documents here. That means that content which is being displayed with this template will use that stylesheet(s).
    JavaScript? ressourcesYou can include one or more javascript ressources here. Content which is being displayed with this template will include the javascript code from that ressources.
    Addition to headerYou can write (?DML?) code which is added to the header-tag of the content.
    Addition to bodyYou can write (?DML?) code which is added to the body-tag of the content.
    preDML / postDMLsee next section

    Pre DML and Post DML

    You can write HTML, Javascript etc. as you like here. The stuff from the 'preDML' field will be written before the 'RT' field, the 'postDML' will be written after the 'RT' field.

    Beside HTML you can use (?DML?), too. The DML will be evaluated against the content document which is being displayed.