Hello,
You can define your own macro. The macro is in the {% ProcessCustomMacro("Expression", "") %} format. When the macro is needed to be resolved, it calls the ResolveCustomMacro method located in the
~/App_Code/Global/CMS/CMSCustom.cs class (or ~/Old_App_Code/Global/CMS/CMSCustom.cs if you installed the project as a web application).
Example: “Current time: {% ProcessCustomMacro("CurrentTime", "") %}” will be resolved to “Current time: 1/1/2008 10:30“ with following custom macro handler:
/// <summary>
/// Custom macro handler
/// </summary>
/// <param name="sender">Sender (active macro resolver)</param>
/// <param name="expression">Expression to resolve</param>
/// <param name="match">Returns true if the macro matches (was resolved)</param>
public static string ResolveCustomMacro(MacroResolver sender, string expression, out bool match)
{
match = false;
string result = expression;
// Add your custom macro evaluation
switch (expression.ToLower())
{
case "currenttime":
match = true;
result = DateTime.Now.ToString();
break;
}
return result;
}
Best regards,
Jan Hermann