During publishing Tridion generates (or better said transforms) some code, depending on certain settings, such as:
Also, the Target Language is used by PageContentAssembler class, when it retrieves the content of a Page. This functionality is mainly used when serving a page through the OData service (aka Content Delivery Webservice).
Second, the Output Format specifies how the DCP content is handled when presented on the website. The ComponentPresentationAssembler class should be used for this. Depending on the format, the content is either retrieved directly, or first executed and then result of the execution is returned.
So to conclude, there are several settings that allow flexible configuration of code generation (and I haven't event talked about Page and DCP TCDL Transformers). These settings offer great power of configuring how code is handled by Tridion API, but at the same time it also gives room for error. Some of the common mistakes are the following (make sure you avoid them):
- Publication Target Target Language;
- Component Template Output Format;
- Deployer config TCDLEngine Properties;
Let's see some details about these parameters and how they work with each other.
Publication Target
The Target Language specifies the destination language that the Deployer should transform any TCDL (Tridion Content Delivery Language) code it finds in the Transport Package. You can think about this language as the 'website language' or the Tridion code that is generated by a Page Template (we will tackle the Component Template code in the next section). Common values for Target Language are:
- ASP.NET - select this if you are publishing to a .NET website and the Deployer should transform to .NET code;
Generated code sample:<tridion:ComponentPresentation runat="server" PageURI="tcm:4-5-64" ComponentURI="tcm:4-3" TemplateURI="tcm:4-7-32"/> - JSP - select this if you are publishing to a Java website and the Deployer should transform to Java/JSP code;
Code sample:
<tridion:ComponentPresentation pageURI="tcm:4-5-64" componentURI="tcm:4-3" templateURI="tcm:4-7-32"/> - REL - (Render Engine Language) select this if you are publishing to an OData Deployer or if you are publishing a dynamic website to the Content Delivery Database;
Code sample:<tcdl:ComponentPresentation type="Dynamic" componentURI="tcm:4-3" templateURI="tcm:4-7-32" xmlns:tcdl="http://www.tridion.com/ContentDelivery/5.3/TCDL" /> - None - TCDL is not transformed by Deployer (in fact all TCDL code is stripped out and DCPs are embedded into the Page)
Also, the Target Language is used by PageContentAssembler class, when it retrieves the content of a Page. This functionality is mainly used when serving a page through the OData service (aka Content Delivery Webservice).
Component Template
The Output Format specifies the language (or format) of a DCP. This property only makes sense for Dynamic Component Presentations.
First, this property instructs the Deployer to transform the DCP content to the specified language (or format). Common Output Format values are:
- HTML Fragment - DCP is published with extension .txt and all TCDL code inside it (if any) is stripped out;
- ASCX Control - DCP is published with extension .ascx and code inside it is .NET:<tridion:ComponentLink runat="server" PageURI="tcm:4-455-64" ComponentURI="tcm:4-393" TemplateURI="tcm:0-0-0" AddAnchor="false" LinkText="Read more" LinkAttributes="" TextOnFail="true"/>
- JSP Scripting - DCP is published with extension .jsp and code inside it is Java/JSP:<tridion:ComponentLink pageURI="tcm:0-0-0" componentURI="tcm:4-393" templateURI="tcm:0-0-0" addAnchor="false" linkText="Read more" linkAttributes="" textOnFail="true"/>
- REL - DCP is published with extension .rel (should be in fact published to CD DB) and code inside is TCDL (no transformation takes place during Deployment):<tcdl:Link type="Component" origin="tcm:0-0-0" destination="tcm:4-393" templateURI="tcm:0-0-0" linkAttributes="" textOnFail="true" addAnchor="false" variantId="">Read more</tcdl:Link>
Second, the Output Format specifies how the DCP content is handled when presented on the website. The ComponentPresentationAssembler class should be used for this. Depending on the format, the content is either retrieved directly, or first executed and then result of the execution is returned.
Deployer Config
The Deployer configuratin under node Deployer/TCDLEngine/Properties influences the way the TCDL code produced by the Publisher gets transformed into the language specific code. The most commonly used are the following:
<Property Name="tcdl.dotnet.style" Value="controls" />
<Property Name="tcdl.jsp.style" Value="tags" />
<Property Name="tcdl.dotnet.style" Value="controls" />
<Property Name="tcdl.jsp.style" Value="tags" />
When either of these properties is present, the code for the respective language will be generated using Tridion user controls or custom tags.
If either of the property is missing, code generation falls back on default language -- the old school inline JSP or .NET scriptlets.
Example scriptlet for JSP:
<%@ page
import="com.tridion.web.jsp.JSPPage"%>
<%@ page
import="com.tridion.web.jsp.ComponentPresentationAssembler"%>
<%
JSPPage waiPage = null;
ComponentPresentationAssembler cpAssembler = null;
%>
<%
waiPage = new JSPPage(pageContext,
"tcm:4-455-64");
cpAssembler = new
ComponentPresentationAssembler(waiPage);
%>
...
<%out.print(cpAssembler.getContent("tcm:4-395","tcm:4-423-32"));%>
Example scriptlet for .NET:
<%@ Import
namespace="Tridion.ContentDelivery.WAI"%>
<%
ComponentPresentationAssembler
componentPresentationAssembler = null;
%>
<%
componentPresentationAssembler = new ComponentPresentationAssembler("tcm:4-455-64",Page);
%>
...
<%Response.Write(componentPresentationAssembler.GetContent("tcm:4-395","tcm:4-423-32"));%>
So to conclude, there are several settings that allow flexible configuration of code generation (and I haven't event talked about Page and DCP TCDL Transformers). These settings offer great power of configuring how code is handled by Tridion API, but at the same time it also gives room for error. Some of the common mistakes are the following (make sure you avoid them):
- language mismatch between Target Language and Output Format (e.g. one set to None, the other to JSP);
- location misconfiguration: e.g. REL DCP published to the file system, or JSP DCP published to CD DB;
Comments