Creating dynamic labels within SDL Tridion content

Recently a client required a way of creating and storing ‘dynamic’ values within the content managed in SDL Tridion.  By ‘dynamic’, this could be anything from loan rates, petrol prices or the cost of a pint of beer.  So today ‘pint_beer_cost’ could be $3.50, tomorrow it could be $4.50.  Having to go through all stored content and replace $3.50 with $4.50, every time there is a need to change a value would be quite painful.

To enable the customer to manage dynamic labels using SDL Tridion, we (*cough* shameless plug) provided a solution built the following elements:

  • A GUI Extension that allowed the user to select dynamic terms from a list and embed them directly into their SDL Tridion rich text field.
  • A configuration component that allowed users to configure these key/value items.
  • An SDL Tridion Category which is used to store the selectable dynamic values (as keywords).
  • A mechanism to replace the ‘pint_of_beer’ with the latest dynamic value.  There are two solutions to this (Nick has a great article discussing the differences between Published / Dynamic SDL Tridion Content if you’re not familiar with the two.)
    • Baking in the CMS: Creation of a Template Building Block (TBB) to resolve (or replace) the ‘key’ with the currently configured value.
    • Frying Server-side: Content Delivery code (.Net, Java, PHP etc) should the customer wish to resolve this content at the presentation server.

So here’s how all these pieces fit together to make an elegant solution for the user:

3 thoughts on “Creating dynamic labels within SDL Tridion content

  1. Nice! The biggest gotchas I see when making extensions is that users expect all the Tridion functionality to apply. Where Used should work, but also BluePrinting and localization, Content Port between systems, the security model (users are not admins), and especially item changes need to work going forward.

    Using Tridion’s keywords lets us update their display names and you have a way to make Where Used work. You can even localize these if needed. The customer should be careful with changing the inserted values, but I’m sure you’ll have a follow up post when they ask to change $$some_value$$ to $$some_new_value$$ everywhere. :-)

    Minor point: I’d consider swapping key and description, but otherwise looks great. Where can we show you some love on StackOverflow?

  2. @Alvin – You can show me some love by going and upvoting everything i ever did on SO :)http://stackoverflow.com/users/1221032/johnwinter

    In terms of a user localising / changing this information you’re right. It would probably have been better to use a keyword key as this can’t be changed, but thebusiness users wish to have this localisation flexibility. They are a good team though, so i’m not too worried here :)

  3. Very Nice. Thanks.
    I’m interested in how can this be extended to display different labels according to visitor’s context (claims in ADF). e.g.: visitors from UK will see price in pounds (£).
    I’m not that familiar with SmartTarget but it does not seem to easily fit since SmartTarget uses Regions as placeholders for content and I don’t think it is feasible to embed regions within a rich text field.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>