What's a Template?

A template is the basis of a CMS-document. It defines the basic layout, which "fields" (images, links, richtext-fields,...) are available for the editor and how they are arranged. You can also build more sophisticated templates like including other modules, using different styles/fields/behaviour based on the editors input,...

Creating Templates

Templates could be created/modified in the Corinis Templated Editor or created in any external editor and copy&pasted to the editor. Saving a template in the Corinis Editor checks the template for XHTML-conformity and displays any problems it finds (another possibility to check xtml conformity is to rename the file to .xml and open it with Microsoft Internet Explorer). The editor also offers a code-beautifier which beautifies the saved template code (tabs, linebrakes, etc.).

Please keep in mind, that Corinis templates are also managed by the authority-system. So if you want to make it available for editors you have to assign the object authorities to the corresponding group/users.

XHTML-Conformity

The important thing about Corinis-Templates is, that they have to be XHTML-conform - this means:

  • There have to be one and only one root-element. This tag will be removed when using the template and is just for xhtml-conformity. Please use for example (<corinis> as root tag)
  • All Tags have to be closed: <br> is not a valid tag unless also a </br> exists - so use <br/>, or <input .... /> and not <input ...> etc.
  • Mind the order of the tags: <i><b></i></b> is NOT valid - <i><b></b></i> is valid
  • All attributes have to have values: Not valid: <select multiline> <- multiline attribute has no value, Valid would be: <select multiline="multiline">
  • All attribute-values have to be enclose by " - so <a href=www.corinis.com> is not valid - valid is <a href="www.corinis.com">
  • Don't use escape codes (&uuml; &auml; etc.) - but use ANSI-Codes (&#160; etc.) instead. See the corresponding table to find out which code has which ANSII code

Template Tags

A Corinis template is "normal" HTML-Code (XHTML compatible) extended by some additional corinis-tags. These Tags are:

corinis

This is the root element of a template and is just for XHTML-compatibility. This tag will be removed in output.

corinis-attribute

This tag allows to add attributes to elements (does not work with other corinis-tags) - it is therefore quite similar to xsl:attribute in XSL Stylesheets.

If you want to use <corinis-life> to disable the showing of the content of the attribute in edit-mode, make sure you use the <corinis-life> INSIDE the <corinis-attribute> not surrounding it. If you do it the wrong way around the attribute will be applied to the corinis-life tag and not to the tag you want it to be.

For example if we want to make the background of a DIV Tag editable:

<div>
  <corinis-attribute name="style">background-color:<corinis-field type="show" name="color"/></corinis-attribute>
  <corinis-comment>Backgroundcolor: <corinis-field name="color" type="text"/><br/></corinis-comment> 
  I have different backgroundcolors!
</div>

We add the style attribute to the div element. If a text is entered in the corinis-field "color" - this text will be used as backgroundcolor for the DIV. If we enter for example red - the resulting HTML Code in Life-System would look like that:

   <div style="background-color:red">
      I have different backgroundcolors!
   </div>

corinis-field

This tag is used to define input-fields for the editor. Whith the attribute type we define which type of input-fields.

corinis-field type="checkbox"

This defines a checkbox as input field. If it is selected the field with the defined name will get the value 'X'. This value could for example evaluated via <corinis-exist>.

<corinis-field type="checkbox" name="feld"/>

corinis-field type="text"

This defines a simple textfield. The attribute size corresponds to the size attribute for HTML-input fields.

<corinis-field type="text" name="feld" size="XX"/>

corinis-field type="textfield"

This tag defines a multiline textfield (quite similar to HTML-textareas). The attributes "rows" and "cols" corresponds to the HTML-attributes of the same name.

<corinis-field type="textfield" name="feld" rows="10" cols="50"/>

corinis-field type="richedit"

This tag defines a richtext block. These are the fields where the text of a document is entered (simple textfields are normally used only for headlines etc.) The editor (user) can enter text with a special richtext-editor. Per default richtext-fields allow a variety of styles which can be used (like fonts, colors, etc. etc.) by the editor. If you don't want that (normally an editor shouldn't change colors, fonts etc.) you can use the following options:

  • filterfont="true/false": filters the textcolor, style and type (<font> tag)
  • highlight="true/false": filters all highlighting possibilities (like <b>, <strong>, <i>,..)
  • table="true/false": Allows the creation of tables
  • list="true/false": Allows the creation of lists (ul/ol)
  • filterall="true/false": This filters all format and style information except linebrakes and highlighting.

The richtext-editor only works with:

  • Microsoft Internet Explorer 6.0 and later
  • Netscape 7.1 and later
  • Mozilla 1.2 and later
  • Firefox 1.0 and later
<corinis-field type="richedit"/>

corinis-field type="image"

Defines a input-field for images (these can be loaded from the image-library). The attributes "width", "height" and "border" correspond to the same named attributes of the HTML <img> tag

Other attributes:

  • minwidth: the minimum width of the image
  • maxwidth: the maximum width of the image
  • minheight: the minimum heigth of the image
  • maxheight: the maximum heigth of the image

If you want to have the picture in an exact size minwidth/maxwidth and minheight/maxheight must all be defined and each pair must have the same values. The attributes "widht" and "height" also allow the definition of an exact size, but the the image will be rendered on the client-side when displayed and not on the server-side which in most cases results in an much worse quality.

<corinis-field type="image" name="feld" width="50" height="100" border="0"/>

This tag defines an input field for internal and external links. You can use all attributes which are possible for the HTML - <a> tag. You implement a static text which will then have the link or you can use the link-tag around another corinis-field and are therefore able to link a picture or dynamic text.

<corinis-field type="link" name="feld" target="" internaltarget="">Static text of link</corinis-field>

Attributes:

target/internaltarget

The attribute "internaltarget" corresponds to the "target" attribute but is used for internal links (links to documents within the CMS-system). The attribute "target" is used for external links.

<corinis-field type="link" name="link" target="_blank" internaltarget="_top">
  <corinis-field type="text" name="link_text"/>
</corinis-field>

internal links

Per default all internal links are converted into '?Document_id=42345789' (<- the number is an example for a document id). If you don't want that style you can choose your own style via: Cms.setInternalLinkStyle(style) - whereas style is a string which could contain the following keywords:

  • $id corresponds to the id of the document
  • $name corresponds to the name of the document
  • $path corresponds to the path of the document (e.g. /area1/doc2)

corinis-field type="teaser"

A teaser is a short abstract of a document which should tease the user to read the complete document (and therefor follow the link to it). The editor then chooses a document which he want to be teasered. The teaser tag has the important attribute "xsl" which states the xsl-file which defines what fields would be teasered and how the teaser looks like.

<corinis-field type="teaser" name="tease" xsl="teaser.xsl"/>

teaser.xsl (example):

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:template match="/">
  <table width="400" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td>
     <span class="textfett"><xsl:value-of select="/DOCUMENT/field1"/></span>
    </td>
   </tr>
   <tr>
    <td>
     <span class="text"><xsl:value-of select="/DOCUMENT/field2"/></span>
    </td>
   </tr>
  </table>
 </xsl:template>
</xsl:stylesheet>

In this example we display field1 and field2 of the document the editor chooses to be teasered. Note that the fieldnames (field1 and field2) correspond to the names given to the input-fields of the document in the corresponding template of the document. Meaning that in the example above the document has to have a template which defines at least the two input-fields field1 and field2 - for example <corinis-field type="text" name="field1/>

corinis-field type="show"

This tag simply shows the value of the field as saved in the database. It is more or less only useful for textfields, since wiht images only the name of the image will be shown.

<corinis-field type="show" name="feld"/>

corinis-repeatable

This tag makes it possible for the editor to repeat certain parts (everything within the corinis-repeatable tag). For example you can define an image/text block (image left, text right). Without the corinis-repeatable tag - it is only possible to enter one picture with one textblock. If you want to allow to have more such blocks - you would put a corinis-repeatable around this block and then the editor can repeat the block as often as he wants. Also the corinis-repeatable has a name, since you can have more repeatable blocks in one template (even into each other)

<corinis-repeatable name="repeat1">
  <corinis-field type="text" name="textfield" size="10"/>
  <corinis-field type="image" name="image"/>
</corinis-repeatable>

corinis-comment/corinis-preview/corinis-life

The code within this tag would only be executed in the edit-mode but not in QM or life-mode (in corinis-comment) and vice versa with the other tags. corinis-comment allows the placing of comments for the editor (like: please enter the this and that here....). But it is also very useful to allow the editor to choose among predefined styles or similar. For example you could implement a checkbox which should allow the editor to choose wether he wants a border around his text or not. You would then place the checkbox within a corinis-comment tag (only visible in edit mode - since we don't want to see the checkbos in life-mode) and then check with <corinis-exist> if the checkbox is checked and apply the corresponding style.

<corinis-comment>
 <font color="red">Please enter a maximum of 2000 characters</font><br/><br/>
</corinis-comment>
<corinis-field type="richedit"/>

corinis-comment/corinis-preview/corinis-life as comments

If you place corinis-comment/-preview/-life in comments you specify code which would only be executed in edit/life/ or preview mode. Note that corinis-tags want work within these tags. The code will be ignored by the parser and therefore don't have to be XHTML-compatible. Special characters still have to be escaped.

<!--corinis-comment
Code which would be executed in edit-mode only
-->

<!--corinis-life
Code which would be executed in final/life-mode only
-->

<!--corinis-preview
Code which would be executed in qm/preview-mode only
-->

corinis-include

This tag allows you to include templates, modules, functions etc.

<corinis-include type="template" id="ID"/>

The example above includes another template (so you can build template-hierachies). The attribute ID - defines the id of the template to be included. You'll find out the id in the template-manager.

Template 1:
<!-- Content-Block-->
<corinis-repeatable name="repeat">
 <table width="100%">
  <tr>
   <td>
    <corinis-field type="image" name="image_left"/>
   </td>
   <td>
    <corinis-field type="text" name="title"/><br/>
    <corinis-field type="richedit" name="text"/>
   </td>
  </tr>
 </table>
</corinis-repeatable>

Template 2:
<!-- Navigation -->
<table width="100%">
 <tr>
  <td>
   Code which creates navigation
  </td>
 </tr>
</table>

Template 3:
<!-- Whole Page -->
<table width="800">
 <tr>
  <td width="20%">
   <corinis-include type="template" id="ID of Template 2"/>
  </td>
  <td width="80%">
   <corinis-include type="template" id="ID of Template 1"/>
  </td>
 </tr>
</table>
<corinis-include type="module" name="Modulname" xsl="XSL-File">
<FUNCTION>functionname</FUNCTION>
Parameter
</corinis-include>

The example above calls the function of another module. The XML-response tree returned by the function will be parsed through the xsl file stated. The parameters are the request-parameters for the function (but without the module-prename).

<!-- Creates an overview of all documents in the current directory + values of the field HEADER (defined in the template)-->
<corinis-include type="module" name="CmsLifeFileManager" xsl="show.xsl">
 <FUNCTION>getFileManager</FUNCTION>
 <id>$Document_id</id>
 <top>$Document_top</top>
 <field>header</field>
</corinis-include>

With techniques like the one shown above you can build automatic overview pages (nodes) which displays the titles / teasers etc. of all documents beneath.

cacheable

If the attribute cacheable is set to "true", the document could be cached although <corinis-include>. This is only recommended if you use CMS-functions with <corinis-include> (if a document goes life, the cache will be regenerated automatically which isn't the case with other modules than CMS)

value

If you call a module it could be the case that you have to choose an element (e.g. embed a voting).

Example for an embedded voting:

<corinis-include type="module" xsl="admin/voting_result.xsl" name="Voting"
value="voting">
<FUNCTION>getEntry</FUNCTION>
<mainId>$value</mainId>
<instance>1</instance>
</corinis-include>

Example for an embedded photolibrary:

<corinis-include type="module" xsl="admin/photolibrary_view.xsl"
name="PhotoLibrary" value="pictures">
<FUNCTION>getEntries</FUNCTION>
<mainId>$value</mainId>
</corinis-include>

CMS-Variables

The follogin cms-variables are available:

  • $Document_id will be replaced by the id of the current document
  • $Document_top will be replaced by the top of the current document
  • $value the value to be included (see value/getvalue)
  • $Document_parent the parent of the current document
  • $Document_path the path of the current document

corinis-get

With this tag you can retrieve certain information. Which information is specified via the "name" parameter. At the moment you can retrieve ID, IP of the current user as well the the current time and date:

<corinis-get name="username"/> - the current logged in user
<corinis-get name="userid"/> - the current logged in user-id
<corinis-get name="userip"/> - the current logged in user-ip
<corinis-get name="date"/> - the current date

You can also get document specific information using corinis-get:

<corinis-get name="document_name"/> - the name of the document
<corinis-get name="document_id"/> - the id of the document
<corinis-get name="document_editor_username"/> - the username of the editor of the document
<corinis-get name="document_editor_userid"/> - the user id of the editor of the document
<corinis-get name="document_create_date" format="dd/MM/yyyy hh:mm"/> - the creation date of the document (optional format)
<corinis-get name="document_create_ldate"/> - the creation date of the document in milliseconds
<corinis-get name="document_change_date" format="dd/MM/yyyy hh:mm"/> - the last change date of the document (optional format)
<corinis-get name="document_change_ldate"/> - the last change date of the document in milliseconds

document structure information

<corinis-get name="prename"/> - get the prename of the repeatable level (can be used ie. for ids if you want some javascript for each repeatable)

other information

<corinis-get name="request" value="nameofparam" default=""/> - get the request (post or get) parameter "nameofparam" (use default if nonexistent)

corinis-exist/corinis-nonexist

This tag checks wether in the specified corinis-field data was entered or not. This works only in preview and life-mode but not in edit mode!

<corinis-exist name="fieldname as defined in template">
Code
</corinis-exist>

If data was entered in the specified field - the code will be executed - if not the code won't be executed.

<corinis-field type="image" name="image1"/><br/>
<corinis-exist name="bild">Copyright: <corinis-field type="text" name="copyright"/></corinis-exist>
<corinis-nonexist name="bild">No image</corinis-nonexist>

The example above displays a copy-right-text if a image was entered by the editor, if not the text "no image" will be displayed.

corinis-exist/corinis-nonexist as attribute

Each tag could have the attribute corinis-exist/corinis-nonexist. If you use it as attribute it only coveres the very same corinis-field but not the code within the corinis-field.

<corinis-field type="link" name="linking" corinis-exist="linking">
   <corinis-field type="image" name="image1"/>
</corinis-field>

In the example above, the image would be shown with the link if a link exists, if not - only the image will be shown.

Note that if a tag contains the corinis-exist attribute as well as the corinis-nonexist attribute - both will be linked via an AND.

corinis-root

This works similar to corinis-exist but checks on the current site-root. You have different site-root for example if your website has different languages. You specify the siteroot you want to check via the "id" attribute.

The head tag is used quite the same way as in any normal html-document - with one exception: Because the cms-editor is complex the head tag will be inserted afterwards. if you combine the head-tag with corinis-comment/life/preview you can have differten head-tags for the different systems.

Template Tag overview

nametypeattributedescription
corinis first tag in a template -will be removed in output
corinis-attribute nameadd an attribute to the element above
corinis-fieldtextname [target,internaltarget]simple input-field (corresponds to <input>)
corinis-fieldcheckboxnamecheckbox
corinis-fieldtextfieldname [target,internatltarget]multiline text-field (corresponds to <textarea>)
corinis-fieldricheditname [target,internatltarget,filterfont,hightlight,table,list,filterall]richtedit-textfield (main content field)
corinis-fieldimagename [min/max-width/height]image from the multimedialibrary (corresponds to <img>)
corinis-fieldlinkname [target,internaltarget]internal or external link (corresponds to <a>
corinis-fieldteasername, xslteaser field
corinis-fieldshownameshows the value of a field
corinis-repeatable namerepeatable blocks
corinis-comment comments and code only executed in edit mode
corinis-life code only executed in life mode
corinis-preview code only executed in preview
corinis-includetemplatename, idincludes another template
corinis-includemodulename, xsl,...includes another module
corinis-exist namechecks if a certain field has a value (input from the editor)
corinis-nonexist namechecks if a certain field doesn't have a value (input from the editor)
corinis-root idchecks if the current root = id
corinis-get name(=username)|userid|userip|date|param|...display system information
head will be shown in head while editing

Note

  • the attribute name uniquely names an element - within a template a name have to be unique
  • for corinis-field tags it is possible to use more attributes than listed above. These attributes will be passed on to the final output (for example the width/height attribute in type=image will stay the same in the final <img> tag
  • target and internaltarget is for targets in links whereas target is for external links and internaltarget for internal links (links to documents in the CMS)
  • If you change a template DON'T change the names of the fields since the data entered by the editor is stored with this name. You can change the underlying template of a document (if you want to have the data aranged differently) or with the help of symbolic links you can display one document with 2 different templates and therefore in 2 different styles - but this works only if the fieldnames are the same. The same goes for teasers which display certain fields (identified by name) - so if you want teasers to work also with documents with different templates we recommend that you use some standardnames in your templates (such as: header, subject, title, teasertext, maintext, mainimage,... or something of that kind)