Creating default Template Building Blocks
You can create your own Template Building Blocks and have them loaded into the Content Manager as default templates by creating an XML setup file containing XML instructions for loading default templates and registering your XML setup file in the Tridion.ContentManager.config configuration file.
Procedure
- Create your default Template Building Blocks: .NET Assemblies, C# fragments, or Dreamweaver Templates.
- Create an XML setup file that uses SetupTemplates.xsd schema called, for example, MyTemplates.xml:
<?xml version="1.0" encoding="utf-8"?> <setup> <templates> <assemblyTemplate id="Templates" assemblyPath="..\bin\Tridion.OutboundEmail.Templating.Templates.dll"/> <cSharpTemplate wrapperForTemplate="Activate Tracking"assemblyTemplateRefId="Templates"/> <dreamweaverTemplate title="MyDreamweaverTemplate" filePath="..\schemas\DreamweaverTemplate.dwt"> </dreamweaverTemplate> <compoundTemplate title="MyCompoundTemplate" itemType="TemplateBuildingBlock"> <templateInvocations> <templateInvocation title="Publish stuff"/> </templateInvocations> </compoundTemplate> </templates> </setup>Note: By default, the SetupTemplates.xsd schema is located in %TRIDION_HOME%\schemas.Where:assemblyTemplatehas the following attributes:id—(mandatory) a logical string identifier.assemblyPath—(mandatory) the location of the .NET assembly, which can be a relative path from the Tridion.ContentManager.config configuration file or an absolute path. For information on how to upload a .NET assembly to the Content Manager using the TCMUploadAssembly.exe, see .
cSharpTemplatehas the following attributes:wrapperForTemplate—(mandatory) user-friendly name to identify the template.assemblyTemplateRefId—(optional) the ID of the Assembly Template containing this template.
dreamweaverTemplatehas the following attributes:title—(mandatory) the user-friendly name of the template.filePath—(optional) the location of the template if saved to a directory under %TRIDION_HOME%; the path is either a relative path to theTridion.ContentManager.configconfiguration file, or an absolute path.resourceName—(optional) the location of the template if included as an embedded resource within an Assembly Template. The value is a resource identifier specified using dot notation.assemblyTemplateRefId—(mandatory ifresourceNamespecifed) the ID of the Assembly Template containing the Dreamweaver Template specified byresourceName.
Note: You must specify eitherfilePathorresourceNamefordreamweaverTemplate.A
dreamweaverTemplatecan contain a<parametersSchema>element. For more information, see Loading Parameter Schemas for default Template Building Blocks.compoundTemplatehas the following attributes and elements:title—(mandatory) the user-friendly name of the template.itemType—(mandatory) the type of the template:PageTemplate,ComponentTemplate, orTemplateBuildingBlock<templateInvocations>—acompoundTemplatecontains<templateInvocations>that refer to templates that are registered in this XML setup file. Each<templateInvocation>element has a mandatorytitleattribute specifying the user-friendly name of the template invocation:<templateInvocations> <templateInvocation title="Publish stuff"/> </templateInvocations>
- Save the XML file to your Content Manager server, in a folder location under %TRIDION_HOME%, for example, in a templates\ subfolder, and in the config\ subfolder of %TRIDION_HOME%, open Tridion.ContentManager.config for editing to register your file by adding a
<defaultTemplatesScript scriptFile="">element that points to the location of the XML script file. For example:<defaultTemplatesScripts> <defaultTemplatesScript scriptFile="..\templates\MyTemplates.xml" /> </defaultTemplatesScripts>The
scriptFileelement specifies either a path relative path to the Tridion.ContentManager.config configuration file or an absolute path.