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:
- Macros that display information are defined in the widget_webcore_show.ftl template.
- Macros whose main purpose is to allow the user to input information are defined in the widget_webcore_edit.ftl template.
- Macros that display data (mainly lists) are defined inside the widget_webcore_data.ftl template.
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") />
Here a screenshot of Eclipse project:
The FreeMarker templates in MUM and CMS include the basic macros of 'webcore' and add their own specific macros for the administration pages (located in /web/templates/ of each modul):
The macros of the modul 'wsm' (website manager) are used to create the public websites. Each scheme gets its own set of macros. Therefore you find these macros in /web/templates/_scheme_name_/. Additionally macros for all schemes are located in /web/templates/common/:
Here you can find the documentation of the basic macros of the package 'webcore' of the Tiny Marbles Framework.
- Tiny Marbles Framework