Advanced Templates

Last Updated: Jan 13, 2020
documentation for the dotCMS Content Management System

Advanced Templates give seasoned dotCMS and web developers the flexibility to create any layout, look and feel or content delivery format as per custom requirements. An advanced template can be used to deliver a JSON content stream, a simple content or widget or an entire look and feel. An “Advanced Template” is really just an text/XML/HTML/Velocity template in dotCMS that can be used when creating pages.

To add a new Advanced Template first mouse over the Site Browser tab and select the Templates.

Then click the “Add Template –> Advanced Template” button in the upper right hand corner of the template listing page.

Remember that Templates are merely the layout for the HTML/CSS, Velocity Code, and Containers that help to pull together a live HTML page as it is visited on the site. When a dotCMS HTML page is visited, all the Content, Containers and Templates connected to that page are pulled together instantaneously from the content repository. Although HTML/CSS and Velocity can be placed in Templates, Containers, and Content, the diagram below helps to illustrate the basic hierarchy of elements that call on each other to display an HTML page.

Adding Containers to a Template

Add Containers to the template by placing the cursor where you want a container and pressing the “Add Container” button. This will bring up a popup window in which you can browse for the right container and it will place the needed code back in the template. In the code example below, the “Add Container” button was used to add the velocity code to parse the header, the body, and the footer containers highlighted in red. Click here for a tutorial on how to make your first template.

  • Putting width constraining elements within the template which wrap around the containers helps keep the page elements in the right place when in preview mode.
  • A container can only be used once in a template.

Templates can be permissioned based upon user roles, for more information on permissions please see the documentation section on Template Permissions.

On this page


We Dig Feedback

Selected excerpt: