Skip to main content

Posts

Showing posts with the label Templating

Creating a DXA Java Module

In my previous blog post Troubleshoot a DXA Java Module , I presented a solution for a very specific issue with loading a DXA Java module. Then I had the idea for this blog post -- write a short tutorial on how to write a DXA module. What follows are the steps to create a new DXA Java module (I am using DXA v1.5). In this post, I present the Content Manager items needed for the new module. In fact, these are the minimum items and properties needed for having a new working DXA module. In next post Creating a DXA Java Module (part 2) , I present the Java code and configuration needed to run the new DXA module in a web-application. 1. Create a New Module in Tridion Content Manager I am using DXA reference implementation, and I created a new module called Emerald, next to the Core module of the reference implementation. Create the following Tridion folder structure starting from Folder Emerald : 2. Create Module Configuration Component In Folder Admin , create new Componen...

.GetItems() Slower than .GetListItems() - Is It Not?

An old-school Tridion best practice says " whenever possible try to use GetListItems over GetItems due to significant performance degradation on the latter ". Now that might have been very well possible on the old TOM (Tridion Object Model). But is it still the case with TOM.NET? Let's see... In my previous three posts, I have been playing with several ways of generating navigation XML based on Structure Groups and Pages: Generate Structure Group Navigation - GetItems TBB  - gets all SGs and Pages in one call to .GetItems() using a filter with Recursive=true . It then iterates the list of objects and creates an XML document using the hierarchy given by the items' OrganizationalItem property; Generate Structure Group Navigation - Reorder TBB - gets all SGs and Pages in one call to .GetListItems() using a filter with Recursive=true . It then iterates the flat XML, instantiates SG and Page objects using the Engine.GetObject() method, and uses the .Organizationa...

Generate Structure Group Navigation - Recursive TBB

This TBB Generates an XML containing all Structure Groups and Pages whose title abides to a naming convention, in hierarchical structure. The naming convention is given by regular expression (e.g. title starts with 3 digits followed by underscore or space). This TBB is available on my Google Code project yet-another-tridion-blog / Template Repository  (file / PT / Navigation / GenerateStructureGroupNavigationRecursive.cs ). Description Name Generate Structure Group Navigation Reorder TBB Type ·     Template in .NET Assembly Description Used to: ·    Generate navigation XML; Notes: This TBB reads the Publication's Root Structure Group and retrieves all child SGs and Pages using the .GetListItems() method in a recursive way. The template retrieves the SG/Pages directly under the given SG and it then iterates each node, invoking a recursive step for each SG it encounters, thus ensuring the entire hierarchical structure is...

Generate Structure Group Navigation - Reorder TBB

This TBB Generates an XML containing all Structure Groups and Pages whose title abides to a naming convention, in hierarchical structure. The naming convention is given by regular expression (e.g. title starts with 3 digits followed by underscore or space). This TBB is available on my Google Code project yet-another-tridion-blog / Template Repository  (file / PT / Navigation / GenerateStructureGroupNavigationReorder.cs ). Description Name Generate Structure Group Navigation Reorder TBB Type ·     Template in .NET Assembly Description Used to: ·    Generate navigation XML; Notes: This TBB reads the Publication's Root Structure Group and retrieves all child SGs and Pages using the .GetListItems() method. The template reorders each node in the retrieved XML and it places it in a hierarchical structure that matches the SG/Page nesting. Each SG object is represented as a  tcm:Item  node that has potential sub-nod...

Generate Structure Group Navigation - GetItems TBB

This TBB Generates an XML containing all Structure Groups and Pages whose title abides to a naming convention, in hierarchical structure. The naming convention is given by regular expression (e.g. title starts with 3 digits followed by underscore or space). This TBB is available on my Google Code project yet-another-tridion-blog / Template Repository  (file / PT / Navigation / GenerateStructureGroupNavigationGetItems.cs ). Description Name Generate Structure Group Navigation GetItems TBB Type ·     Template in .NET Assembly Description Used to: ·    Generate navigation XML; Notes: This TBB reads the Publication's Root Structure Group and retrieves all child SGs and Pages using the .GetItems() method. It creates an XmlDocument object and start building its nodes. Each SG object is represented as a  tcm:Item  node that has potential sub-nodes (other SGs and Pages). The Page objects are represented also as tcm:...

Escaping DWT ${ } Syntax

A while back, I was writing about the Dreamweaver Double Lookup technique for Tridion templating. I was however struggling with escaping the DWT notation, notably with JSTL Expression Language syntax. The EL syntax is the same with DWT's for outputting variables and expressions: ${ expression } I used to output EL expressions as $[ expression ]  and then have a TBB to replace the square brackets with curly braces. Finally, I found out today not one, but two ways to escape the DWT syntax ${}. Both following expressions output ${'Hello, world'} ${'$'}{'Hello, world'} @@'$'@@{'Hello, world'} The trick in both cases is to escape the output of the dollar symbol ( $ ) by using it as String parameter in the surrounding  @@ @@ or ${ } . What follows is the normal unescaped {'Hello, world'} output. Now you know... :) But, wait... we are not there yet! This approach above, only works from a Dynamic CT or a Page Template. Th...

Resolve Static Links TBB

This week's TBB is about resolving Component links statically - i.e. at publish time. This is considered terribly bad practice , but sometimes, in the field, it is just what the custmer needs. It really goes against every Tridion principle and it will make the website completely inconsistent (e.g. dead links cannot be prevented). However, if you need to do it, this it how. The code below reads the 'Where Used' Pages for a Component. It takes the Page publish location URL and constructs a 'static' link to the Page. It will not even check if the page is published. public string ResolveLinkStatic( Engine engine, Package package, Component component) {     if (component.BinaryContent == null ) { // is Content Component         XmlElement node = component.GetListUsingItems(             new UsingItemsFilter (engine.GetSession()) {       ...