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: