Created
January 22, 2013 09:23
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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