ComponentPro UltimateTemplateEngine

      Changing delimiters

      Language Filter: AllSend comments on this topic to ComponentPro

      By default, tags are delimited by {%, /}, {$ and %}; expressions are delimited by '$': $ ... $; comments are delimited by {! and !};  This is good for the most common case of HTML generation. Sometimes, you may want to change the delimiters to avoid conflict with other formats like SQL statement generation. You can change the delimiters by setting BeginChar, EndChar, CommentChar and BeginEndExpressionChar in TemplateEngineSettings class.

      The following example shows you how to change these delimiters:

      <%float f = 10.2f/> <# Initializes variable f #>
      $f$ <# Prints out the variable f #>

      The output will be:


      using System;
      using ComponentPro;
      TemplateEngine dt = new TemplateEngine();
      dt.Settings.BeginChar = '<';
      dt.Settings.EndChar = '>';
      dt.Settings.CommentChar = '#';
      dt.Settings.BeginEndExpressionChar = '@';
      string output = dt.Run();