Skip to main content

Posts

Showing posts from November, 2012

Get Linked Components TBB

This weeks " TBB of the Week " is  Get Linked Components TBB . I don't know who exactly wrote it, so I'm not taking credit for it. It is part of the Templating Base project, IIRC. Name Get Linked Components TBB Type ·     Template in .NET Assembly Description Used to: ·     Extract Component links from Page metadata or from Component fields; ·     Create Package items from the identified Components; Notes: When placed on a Page Template, this generic TBB identifies Component Links from the Page’s Metadata section. When placed on a Component Template, it identifies Component Links in the current Component’s fields (including RTF and Component Link fields) and metadata fields. The TBB pushes each identified Component into the Package. Parameters n/a Applicable to Component Templates and Page Templates This is a very powerful TB...

Create a Schema using TOM.Net API

I was a little frustrated today for not finding out soon enough about the SchemaFields class. Basically that's the class you need when creating a Schema programmatically using TOM.Net API in SDL Tridion 2011. Creating the Schema is easy -- just use the new Schema(session, parentTcmUri) constructor, but creating the fields themselves is a bit tricky. You have to use the SchemaFields class, just like you would use ItemFields on a normal Component fields or on any Metadata fields collections. The code below creates a Schema and adds one RTF field to it and one Keyword based field to its metadata fields: Session session = new Session (); Schema schema = new Schema (session, new TcmUri ( "tcm:20-1-2" )) {     Title = "New Schema" ,     Description = "Schema Description" }; SchemaFields fields = new SchemaFields (schema); fields.Fields.Add( new XhtmlFieldDefinition ( "NewField" ) {     Description...

TBB of the Week - Render Page Text Block

I thought about starting a new section on my blog -- TBB of the Week . The intention is to publish a new TBB every week that is somehow worthy. Maybe it is a very generic one, or a best practice, or even a bad practice. There should be a description of the TBB, what it does, where/how to use it in a Compound Template. Of course, there will be source code too. So to start with, the first "TBB of the Week" is going to be  Render Page Text Block TBB . I first got this TBB from a colleague of mine, Eric Huiza , so I won't take credit for it. Name Render Page Text Block TBB Type ·  Template in .NET Assembly Description Used to: ·  Publish Text Block scripts (JS or CSS) attached to a Page as metadata; Notes: This TBB expects the Page to have metadata field ‘ script ’ that contains a Component Link to the Text Block Component. The TBB creates an Output item (or overwrites the existing one) with the content of the Te...