Template editing can be carried out directly through the CMS WYSIWYG interface. Creating a template is as simple as copying and pasting the relevant HTML source code into the system and then adding extra components to it, such as placeholders.
A typical template build might go as follows:
A design might start its life in a design program such as Photoshop or Fireworks. The next phase is to actually cut the template into HTML and CSS. In the past you may have done this for every template variation, but Contensis makes the process easier by creating reusable components.
Next, identify common elements of the template – usually the header, footer, and main content sections. This forms the base or core template and is what would be created first.
Build up pages by creating variations and subtemplates, reusable elements such as a two column or three column layouts, menus, sidebars and breadcrumbs.
Nest templates by dragging and dropping sub-templates into the core or base template.
If you prefer to have completely separate HTML and disconnected templates for each page type, then this is still just as easy. The choice is yours.
Because templates are content, you have all the standard benefits of the CMS. These include full version histories, publishing schedules, and the permissions workflow.
The template engine allows you to separate design from content using placeholders.
When template creators insert placeholders into a template they have a wide range of options available to control how the placeholder will behave and what the user can do within it. This ensures standardised content structures.
Standard placeholder options include:
- Text Only – only text can be placed within the placeholder.
- Max Length – determine the maximum number of characters which can be entered.
- Constrain Images – specify maximum widths and heights of images.
- Content Types – specify what type of content can be inserted.
- Can Change Styles – specify whether CSS, heading and paragraph options can be used.
- Tag To Render – specify an HTML tag to render around the content.
- CSS Class – specify a CSS class against the placeholder.
Subtemplates allow you to create pages and templates from a previously created set of building blocks. You might use subtemplates for any reusable elements, such as a two column or three column layouts, menus, sidebars, and breadcrumbs.
Some systems offer snippets to achieve this functionality. This causes the content to be trapped within the snippet, making it harder to make changes in the future.
Changing your templates must be easy - let’s face it, the site will be redesigned sooner or later!
CSS can be assigned to page templates by default or forced to appear wherever the template is used. You can also change the CSS at section or subsection level – you may, for instance, have different colour schemes for each part of the site. This is simple to achieve – simply create the different variations and then assign them to the relevant sections.
You may wish to change the stylesheets based upon user input, for personalisation or browser compliance. We offer a simple set of methods to change the stylesheets at runtime if you want to programmatically change the CSS assignment based upon anything you deem relevant.
All types of stylesheet are supported including, for example, print stylesheets.
If you are using our .NET publishing method, then it is possible to write .NET code directly into templates. This can call our core API, the standard Microsoft .NET framework, or your own bespoke components or assemblies.
There are many reasons why having the ability to change execute code at runtime is important. As an example, you may wish to show or hide a component on the homepage of the site based upon a user's role.
One example of custom code use might include hiding or showing an element in the template based upon group membership. In this case we would call the Page API to personalise based upon the user's group membership. For those of you who are concerned that the name of the group may change, you can also pass in the group ID.
If you are a Contensis customer, you can find free custom code examples on ZenHub.