/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public string RenderMacro(string input, int nodeId) { if (string.IsNullOrEmpty(input)) return string.Empty; var regex = new Regex("<\\?UMBRACO_MACRO[^>]*/>", RegexOptions.Multiline | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); return regex.Replace(input, p => { try { return umbraco.library.RenderMacroContent(p.Value, nodeId); } catch (Exception ex) { Trace.Warn(ex.Message); return "Problems Rendering Macro"; } }); }