Documentation Center

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

  1. Create your default Template Building Blocks: .NET Assemblies, C# fragments, or Dreamweaver Templates.
  2. 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>
    Where:
    • assemblyTemplate has 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 .
    • cSharpTemplate has the following attributes:
      • wrapperForTemplate—(mandatory) user-friendly name to identify the template.
      • assemblyTemplateRefId—(optional) the ID of the Assembly Template containing this template.
    • dreamweaverTemplate has 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 the Tridion.ContentManager.config configuration 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 if resourceName specifed) the ID of the Assembly Template containing the Dreamweaver Template specified by resourceName.

      A dreamweaverTemplate can contain a <parametersSchema> element. For more information, see Loading Parameter Schemas for default Template Building Blocks.

    • compoundTemplate has the following attributes and elements:
      • title—(mandatory) the user-friendly name of the template.
      • itemType—(mandatory) the type of the template: PageTemplate, ComponentTemplate, or TemplateBuildingBlock
      • <templateInvocations>—a compoundTemplate contains <templateInvocations> that refer to templates that are registered in this XML setup file. Each <templateInvocation> element has a mandatory title attribute specifying the user-friendly name of the template invocation:
        <templateInvocations>
        	<templateInvocation title="Publish stuff"/>
        </templateInvocations>
  3. 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 scriptFile element specifies either a path relative path to the Tridion.ContentManager.config configuration file or an absolute path.