Templating coding concepts

When you create a C# fragment or a .NET assembly to use as a Template Building Block, you have access to a number of classes, methods and properties. This section deals with the most commonly used of these API items. For a full reference of the API available to you, refer to the TOM.NET API reference documentation included on the media.

In your C# fragment or .NET class, the following variables are available:

  • The package (variable package of type Package). This variable gives access to the contents of the package being processed by the current Template.For more information about the package, refer to Package.
  • The Templating Engine (variable engine of type Engine). This variable gives access to the Content Manager and the items in it. For more information about the Templating Engine, refer to Engine.
  • The Templating Logger (variable log of type TemplatingLogger). This variable gives access to the templating log and lets you write messages to it. These messages appear in Template Builder when you execute a Template.

There are also a number of other classes that you can use directly when writing your own template. For more information about these classes, refer to Other classes.