#INSERT
#INSERT processes and outputs a template in the context of an object that matches the specified content type and unique value.
When used in the context of a publish process, there are a few additional considerations.
- Content Scope - The content must be within the publication content scope (the Publication Content Folder(s) or it's child folders recursively). The exception is when content is referenced with a field=value pair where the field is the OID, DOID or UUID, which will match on content outside of the publication's scope.
- Closest Content - If a more than one object matches the same unique value, the object closest to the primary Publication Content Folder will be used.
Prototype
#INSERT($content_type, $unique_identifier, $template = 'default', ...)
Parameters
- content_type - The content type of the object to insert.
- unique_identifier - A value or field=value pair to uniquely identify the content object to insert. If a single value is provided, it will be matched against the Object Key. If a field=value pair is specified, the Unique/Key field will be matched to the specified value.
- template - Optional identifier associated with a template of the specified content type. If this parameter is not specified, the "default" template will be used. It is common to leave this parameter empty to use the default template, even if there are following parameters. If no Template is specified or named default, the first template defined will be used.
- ... - Optional list of additional parameters that are passed to the specified template as variables ($A for the first, $B for the second, $C for the third, and so on). Each parameter will be evaluated as cTemplate and the result passed in as a string. It will not be evaluated as an expression, even without quotes. Wrap the parameter in #CALC or similar to evaluate as an expression.
Example
Process and output the Image Content Type's HTML template in the context of the Logo Image, and pass 'Alternate Text' in to the HTML template as $A.
#INSERT(Image, Logo, HTML, 'Alternate Text')
Related
#INCLUDE is similar to #INSERT, except that it inserts content from the file system or a URL.