How to use 'default' Template layout

Every cloudCMS page (excluding standalone pages) is rendered through template defined for its group or cloudCMS's 'default' template. The template controls what all contents should be included along with the rendered page.

'default' Template structure

Lots of web content management system has complicated template logic which makes it very difficult to use or create new templates. In cloudCMS it is very simple and flexible so you can create any desired layout.
The template in cloudCMS is single jsp defined as /WEB-INF/template/<template-name>/view.jsp. By default, cloudCMS includes two template with installation : 'default' and 'dynamic'.
The 'default' template is pre-defined HTML structure so it easy to include common sections like header, footer etc along the page.
Following is the code of default/view.jsp.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ taglib prefix="wb" uri="/gaecms" %><html>
<head>
<title><c:out value="${wbpage.description}" default="New Page"/></title>
<wb:includepage name="JS" group="${pageGroup}"/>
</head>
<body>
<wb:includepage name="header" group="${pageGroup}" />
<c:choose>
          <c:when test="${wbpage.id != null}">
        <c:out value="${wbpage.evalContent}" escapeXml="false"/>
      </c:when>
      <c:otherwise>
        <p>Requested page does not exist. <a href="/${wbpage.group}.${wbpage.name}/edit">Create</a></p>
      </c:otherwise>
      </c:choose>
<wb:includepage name="sidebar" group="${pageGroup}" />      
<wb:includepage name="footer" group="${pageGroup}" />
</body>
</html>

From template definition you can see page's content is rendered by including other pages from same page group :
<group>.JS - Add your JS/CSS or any code which you want in HTML's head section
<group>.header - Common header content to include in all pages in same page group
<group>.sidebar - Common sidebar content to include in all pages in same page group
<group>.footer - Common footer content include in all pages in same page group

All the other pages are optional. So if any of the other pages does not exist, cloudCMS will ignore the "includepage" tag.

New template

You can create a new template by just creating a new view.jsp in /WEB-INF/template/<my-template-name>/view.jsp.


blog comments powered by Disqus

Last Modified : Jul 21, 2009 12:01:36 PM