Skip to main content

Posts

Showing posts with the label TBB of the Week

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:...

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()) {       ...

Resolve JS Images In Output TBB

The TBB of this week is Resolve JS Images In Output , originally written by my colleague Eric Huiza . Basically, the TBB does what the name says. It looks for certain images in the Output item and publishes them. The images have to be in TcmUri or WebDAV format and they must appear in the url('path') format. This is the format that a CSS background selector uses, for example, only that it appears in JavaScript. The TB transforms something like: document.getElementById(openingTitleId).style.background=     "url('/webdav/Content/Building Blocks/Assets/images/titlebar.gif') no-repeat"; into this: document.getElementById(openingTitleId).style.background=     "url('/assets/images/titlebar_tcm1-2.gif') no-repeat"; Description Name Resolve JS Images In Output TBB Type ·    T emplate in .NET Assembly Description Used to: ·     Resolve references to Multimedia ...