AI OnAI Off
If your editors accept writing actual things like: "You have donated ${DonatedAmt} this year", you could let them do that.
Add a display template like this, filename: XhtmlString.cshtml:
@using EPiServer.Core
@model XhtmlString
@{
if (Model == null) { return; };
}
@{Html.RenderXhtmlString(Model.ReplacePlaceholders());}
Then, something like this:
public static class XhtmlStringExtensions
{
public static XhtmlString ReplacePlaceholders(this XhtmlString xhtmlString)
{
var contextModeResolver = ServiceLocator.Current.GetInstance<IContextModeResolver>();
if (contextModeResolver.CurrentMode == ContextMode.Edit)
{
return xhtmlString;
}
var processedText = xhtmlString.ToInternalString().Replace("${DonatedAmt}", "1234");
return new XhtmlString(processedText);
}
}
Hi there,
I am wondering if there is a way to pass a calculated value into the TinyMCE editor. For example, when a user logs in, a message can be displayed "You have donated ${DonatedAmt} this year".
Still using CMS 11 and have read posts about dynamic content being deprecated with the recommendation to use a blocks. However, seems like there are issues with nested blocks and rendering inline so was curious if there had been any more recent solutions proposed for something like this?