Get templating

- Template Engine

Temresponsive-email-teplate Engine in StreamServe has been around for a few years now yet it remains one of the least understood technologies by customers. In essence the functionality is very simple and you can create extremely powerful communication designs with it.

The best example to think of here is to create responsive email. Such as the one shown to the left.
code-te

Yet Template Engine’s implementation requires that you know exactly where you
are in the phase of a job. This is bread and butter stuff for people who work with StreamServe every day, yet those who only tinkle with their projects from time to time, may find it like writing their own compiler.

The most fundamental aspect of Template Engine is to understand the following:
A template (containing programmable logic and structure) is fired off, pulling in data (from variables/message configuration/Composition Center) and produces a text based output. Like this:

flow-te

This way of working separates the logic from the presentation so developers can work on data models and designers can work on designs. Brilliant! This is comparable to StoryTeller that combines a data model and layout at the same time.

So what can you use it for?

  • Generating XML, documentation, source code (any language), HTML, SQL, and so on. Basically any structured text output.
  • Creating complicated email such as responsive email – it even has the ability to dynamically add attachments.
  • Text manipulation, stripping and formatting data with regular expressions and picture clauses.
  • Creating archive objects, command programs, charts, SVG objects, etc.
  • Grabbing Composition Center sections and manipulating the contents…. highly useful!
  • Creating new templates….. magic!
  • And the list goes on.

where-te

Where can you use it?

  • In scripts (highly useful for complex text formatting)
  • As a process (useful for bolting in to existing projects)
  • As a filter (for very special cases)

Why did the product engineers build this? They probably saw an opportunity to enrich the product on a broad front and took it. There may also be some future improvements down the line. Doctricks is very happy about this as many of our customers now use Template Engine for generating millions of responsive emails per day, fine tuning texts to produce highly personalised letters and removing load from queues for low-priority processes. Previously these activities would not have been possible without Template Engine.

Some core details:

  • It’s fast. It’s very fast. It’s so fast that you really should try to check how fast it is.
  • Template Engine is an implementation of Apache Velocity – the similarities in the documentation are incredible. Lots of stuff on the internet to search for in case you need inspiration (or help). More advanced examples of other Velocity implementations can be found here.
  • Templates are processed – not compiled – just like StreamServe configurations.  This is a very useful fact as it allows dynamic changes to templates.
  • Helpful to use the Notepad++ (the ubiquitous text editor) highlighter file for Velocity
  • To check if Template Engine is in your license you should check your license file or try to include a simple Template Engine function in your project and try to run it.

What it does not do (at the moment):

  • You cannot call StreamServe script from a template. E.g. A function or a rule.
  • Call an external program
  • Work too well with binary structures such as generating AFP/PCL/etc.
  • Unknown at this point if an option to preload large static templates is available.

Getting started:

  • Start small and give your self a lot of time to absorb the possibilities with this funky tool.
  • Think about the most common activities that can be replaced with some simple templating.
  • Read the online help documentation.
  • Start templating!

Don’t hesitate to get in touch with Doctricks to find out what Template Engine can do for you.

 

Posted in:

Leave a Reply

Your email address will not be published. Required fields are marked *