Skip to content

Instantly share code, notes, and snippets.

Created January 22, 2013 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4593286 to your computer and use it in GitHub Desktop.
Save anonymous/4593286 to your computer and use it in GitHub Desktop.
Java Unified Expression Language uses the same ${...} syntax as SDL Tridion Template Expression Language. Work around this by writing your JUEL as $[...] in your Dreamweaver TBBs and use this TBB in your page template to convert the resultant output.
using System.Text.RegularExpressions;
using Tridion.ContentManager.Templating;
using Tridion.ContentManager.Templating.Assembly;
namespace SDLTridion.Templating.Example
{
/// <summary>
/// Java Unified Expression Language uses the same ${...} syntax as
/// SDL Tridion Template Expression Language. Work around this by
/// writing your JUEL as $[...] in your Dreamweaver TBBs and use this
/// TBB in your page template to convert the resultant output.
/// </summary>
[TcmTemplateTitle("Convert Output to Java Unified Expression Language")]
class ConvertOutputToJavaUnifiedExpressionLanguage : ITemplate
{
public void Transform(Engine engine, Package package)
{
Item outputItem = package.GetByName(Package.OutputName);
string output = outputItem.GetAsString();
output = Regex.Replace(output, @"\$\[(.*?)\]", @"${$1}");
outputItem.SetAsString(output);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment