Template Class |
One of the most common uses for templates is as the basis for the body of an email message. To see an example of how to use a Template see IEmailService.
The most common format for a template is HTML, but, depending on how it is being used, any text format is supported. Templates support substitution markers whose name/value pairs are typically provided in a NameValueCollection when the template is resolved using one of the various Replace or Expand methods.
The markers may take two forms:
When populated from a IMapper default markers will, by default, be substitued using the DisplayText of the corresponding IField (obtained via DisplayTextGet(DispTextFlags)). However, an optional marker prefix may be included to specify otherwise (see TemplateNodeMarker). For example, {{&first_name}} would mean that the marker should be replaced with the HTML-escapted text for the "first_name" field's caption.
Templates are commonly used for the following purposes:
Templates also support events fired to TemplateExtensionBase components:
Dear {{first_name}} {{last_name}}, <br /> Thank you contacting us regarding interest in our {{product_name}} product. One of our sales people will contact you shortly to help you with any questions you may have and to aid in ordering. <br /> Additional information is available at [[product_url]]. <br /> Sincerely, <br /> {{company_name}}
Namespace: NetQuarry
The Template type exposes the following members.
Name | Description | |
---|---|---|
Template(String, String, Int32, TemplateAttrs, String, String) |
Constructs a template object.
| |
Template(String, String, Int32, TemplateAttrs, String, String, Int32) |
Constructs a template object.
|
Name | Description | |
---|---|---|
Attributes |
Get the TemplateAttrs for this Template.
| |
Category |
Gets the Template's category.
| |
FileID |
Gets the Template's file id for templates that aren't stored locally.
| |
FilePath |
Gets the path to the template file, if any.
Note that certain TemplateAttrs affect how this property is interpreted.
| |
ID |
Gets the Template's ID.
| |
Name |
Gets's the Template's name.
| |
Priority |
Gets the Template priority.
When a user has access to multiple Templates with the same Name, the accessible Template with the
highest Priority number is favored.
| |
Properties |
The Properties collection for the object.
| |
TemplateFields |
Returns the Template's TemplateFields collection of TemplateField objects.
| |
TemplateType |
Gets the Template type.
| |
TextItems |
The localized TextItems collection for the object.
|
Name | Description | |
---|---|---|
Clone |
Returns a MemberwiseClone copy of this object.
| |
Equals | (Inherited from Object.) | |
Expand(IAppContext, NameValueCollection, String, String, String) |
Expands the template using the nameValues.
Unless both High and Low resolutions are required, it is recommend
that you use Expand(IAppContext, NameValueCollection, ContentResolution, String, String, String) to avoid
spurious devlog entries and for slighly better performace.
See Expand(IAppContext, NameValueCollection, ContentResolution, String, String, String) for more information about template expansion.
| |
Expand(IAppContext, NameValueCollection, ContentResolution, String, String, String) |
Expands the template using the nameValues.
| |
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
FireEvent |
Fires the specified ExtensionEvents against the template's extensions.
See TemplateExtensionBase for information about available template events.
| |
GetExpandedBody |
Expands the template using the nameValues.
See Expand(IAppContext, NameValueCollection, ContentResolution, String, String, String) for additional
information about template expansion.
| |
GetExpandedSubject |
Returns the subject expanded with the items from the nameValues
| |
GetFieldList(ContentResolution) | Obsolete.
Gets a semi-colon-separated field list appropriate for use as an IncludeFields string.
Note this method is deprecated in favor of GetFieldList(IAppContext, ContentResolution, TemplateReplaceFlags) because an IAppContext
is required in order to include any inner template fields (see Template.
| |
GetFieldList(IAppContext, ContentResolution, TemplateReplaceFlags) |
Gets a semi-colon-separated field list appropriate for use as an IncludeFields string.
| |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetTemplateNodes |
Gets the collection of TemplateNode objects describing this template.
The collection will be loaded if it has not yet been loaded.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Replace(NameValueCollection) |
Replaces the named tags in the document with the values in the NameValueCollection.
Note that this overload does not support embedded function resolution.
Use the Replace(IAppContext, NameValueCollection, ContentResolution, TemplateReplaceFlags) overload
if embedded function resolution is desired.
| |
Replace(NameValueCollection, ContentResolution) |
Replaces the named tags in the document with the values in the NameValueCollection.
Note that this overload does not support embedded function resolution.
Use the Replace(IAppContext, NameValueCollection, ContentResolution, TemplateReplaceFlags) overload
if embedded function resolution is desired.
| |
Replace(NameValueCollection, ContentResolution, TemplateReplaceFlags) |
Replaces the named tags in the document with the values in the NameValueCollection.
Note that this overload does not support embedded function resolution.
Use the Replace(IAppContext, NameValueCollection, ContentResolution, TemplateReplaceFlags) overload
if embedded function resolution is desired.
| |
Replace(IAppContext, NameValueCollection, ContentResolution, TemplateReplaceFlags) |
Replaces the named tags in the document with the values in the NameValueCollection.
Note that this overload does support embedded function resolution using EmbeddedParser.
Replace expands the template body using only the values in nameValues. To get the expanded body use GetExpandedBody(IAppContext, NameValueCollection, ContentResolution) or Expand(IAppContext, NameValueCollection, ContentResolution, String, String, String). These methods provide additional functionality as described in Expand(IAppContext, NameValueCollection, ContentResolution, String, String, String). | |
ToString | (Inherited from Object.) | |
UsesNodeBasedExpansion |
Gets whether or not this template uses the new node-based template expansion. To enable node-based expansion
system-wide, set the UseNodeBasedTemplateExpansionCompatibility feature. To enable it for a
particular template only set the template's UseNewTemplateExpansion attribute.
|
Name | Description | |
---|---|---|
EqualValue |
Determines if the object value is equal to another object. If the two objects are null, then this returns true.
There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways).
If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.) |