Introduction
In ZenMagick, templates (single files) are organized in themes. There is not a complete fancy templating engine, but I’ve tried to concentrate all code used by templates as much as possible and allow for easy extension and customization.
With the exception of i10n and l18n code, all actual PHP code is kept in the toolbox. The toolbox is available in all templates and is the central place for template code in ZenMagick.
Toolbox
The toolbox is a single class that acts as container for a number of utility classes that provide (static) methods to make templating easier.
As can be seen from the documentation, right now there are 6 different tools in the box: form, html, locale (not complete), macro, net and utils.
Each covers a certain area of functions, for example, the net tool provides a range of methods to generate store URLs.
Templates can either use the convenience variables $from, $html, etc… or use the central object $toolbox.
Example:
$net->url(FILENAME_PRODUCT_INFO');
Customization
As with most classes, toolbox items may be customized by providing alternative implementation classes (without the ZM prefix).
It is also possible to add new elements to the toolbox with something like:
ZMToolbox::instance()->set('foo', new MyFooTool());
The above would result in a variable $foo being available in all templating (including emails, popups, whatever) and also via $toolbox->foo.
Outlook
There are more toolbox tools in planning, in particular a separate tool for admin pages and perhaps one for plugins.