Hello,
I would suggest you to take advantage of the Visible property of the Editable text webpart. You can see a basic example here:
http://devnet.kentico.com/FAQs/Web-parts---Controls/How-to-show-hide-webpart-on-specific-document-with.aspx. Using this approach, the content before/after is shown just if the webpart has set visibility to the true value.
In your case, you can develop a
custom macro which will check, whether the editable region has some content or not. It can look similar to the following code:
case "iseditableregionpopulated":
match = true;
result = "true";
if (CMS.CMSHelper.CMSContext.CurrentDocument.DocumentContent.EditableWebParts["maincontenttext"] != null) // if the editable region exists
{
string contentText = CMS.CMSHelper.CMSContext.CurrentDocument.DocumentContent.EditableWebParts["maincontenttext"].ToString(); // get its content
if (((contentText.Trim() == "") || (contentText.Trim() == "<br />")) && (CMS.CMSHelper.CMSContext.ViewMode == CMS.PortalEngine.ViewModeEnum.LiveSite)) //check whether it is empty and do that only on the live site
{
result = "false";
}
}
else if (CMS.CMSHelper.CMSContext.ViewMode == CMS.PortalEngine.ViewModeEnum.LiveSite) // if editable region doesn't exist and you are on the live site - hide it
{
return "false";
}
break;
You can call this macro like this: {% ProcessCustomMacro("iseditableregionpopulated", "") %}
Best regards
Ondrej Vasil