09/19/2011
title

FreeMarker macros in Tiny Marbles CMS

In Tiny Marbles CMS all HTML pages are created with the Java template engine FreeMarker. FreeMarker is designed to be practical for the generation of HTML Web pages, particularly by servlet-based applications following the MVC (Model View Controller) pattern, which is in case of Tiny Marbles CMS the Apache Struts framework.

Each FreeMarker template of Tiny Marbles CMS in turn calls FreeMarker macros, these macros are called 'widgets' to consistently generate user interfaces in HTML. The most important widgets are declared in the 'widget templates' of the package 'webcore' of the Tiny Marbles Framework. The FreeMarker templates in the folder /web/templates/ of package 'webcore' are devided in in three areas:

The approach with the FreeMarker templates and FreeMarker macros is a powerful feature of Tiny Marbles to create HTML code for administration pages as well as for public websites in a simple and intuitive way. Filtered lists, pagination, trees, tabs, image galleries or Ajax requests can be build very quickly using the widgets of the FreeMarker macro library.  

The widgets can be called with @show, @edit or @data from the following modules of the Tiny Marbles Framework: webcore, MUM, CMS and WSM. Here an example for creating a submit button for an HTML form:

<@edit.button label=action.getText("control.Zone.submit") />
more Complete article