Documentation Center

Loading Parameter Schemas for default Template Building Blocks

Parameter Schemas define the parameter data required by a Template Building Block when invoked within a Modular Template. This task describes how to load Parameter Schemas required by a default Template Building Block.

Procedure

  1. Create a Parameter Schema and save the Schema to disk—for more information, see
  2. Depending on your development environment:
    • If you are developing Dreamweaver Templates or Compound Templates outside of Visual Studio, save the Parameter Schema to a location under %TRIDION_HOME%, for example, %TRIDION_HOME%\schemas.
    • If you are developing your templates in Visual Studio, embed the Parameter Schema as an External Resource as follows:
      • Add the Parameter Schema as a resource to your Template Building Block project.
      • Select it from the Solution Explorer, go to the Properties window and set the file's Build Action to Embedded Resource.
  3. For a C# fragment or .NET assembly, open your Template Building Block and add [TcmTemplateParameterSchema(ParameterSchema,HelpFile)] to the appropriate ITemplate implementation:
    [TcmTemplateParameterSchema
    (ParameterSchema="resource:Templating.Resources.Templates.MyParameterSchema.xsd",
    	HelpFileName="ComponentQuery.html")]
    [TcmTemplateTitle("My template")]
    public class MyTemplate : ITemplate
    {
    	<!--ITEMPLATE IMPLEMENTATION-->
    }

    TcmTemplateParameterSchema takes two parameters:

    • ParameterSchema—specifies the location of the resource in your Visual Studio project (a resource identifier using dot notation, prefixed with resource:)
    • HelpFileName—specifies the name of the help file for the Parameters Schema, if defined. For more information, see Creating help files for Parameter Schemas
  4. For a Dreamweaver Template and Compound Template, open the XML setup file and add a <parametersSchema> element in your <dreamweaverTemplate> or <compoundTemplate> element. For example:
    <compoundTemplate title="MyCompoundTemplate" itemType="TemplateBuildingBlock">
    	<templateInvocations>
    		<templateInvocation title="Publish stuff"/>
    	</templateInvocations>
    	<parametersSchema 
    		title="My Parameter Schema" 
    		helpFile="MyCompoundTemplate.html"  
    		filePath="..\schemas\MyCompoundTemplateParameterSchema.xsd" />
    </compoundTemplate>

    <parametersSchema> contains the following attributes:

    • title—(mandatory) the user-friendly name of the Parameters Schema.
    • filePath (optional)—the location of the Parameters Schema if saved to a directory under %TRIDION_HOME%; either a path relative to the Tridion.ContentManager.config configuration file or an absolute path.
    • helpFile (optional)—specifies the name of the help file for the Parameters Schema, if defined. For more information, see Creating help files for Parameter Schemas.
    • description (optional)—the description of the Parameter Schema (used when it is created). If not specified, the Schema name is used.
  5. Save and close the file.