written by Dennis Reil, 29. June 2011
Did you ever think of implementing your own RenderTag to ease up template development?
Management Server already provides everything you need for that task. There was only one small bug that was actually blocking the load mechanism of custom RenderTags. This was fixed for version 11 now and will soon be available in one of the next hotfixes for 10.1 SP2.
Here are the steps to develop your own RenderTag:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Reddot.CMS.Rendering.Tags; using Reddot.CMS.Rendering.Objects; using System.Xml; using Reddot.CMS.Rendering; namespace My.CustomRenderTag { public class HelloWorldRenderTag : IRenderTag { public HelloWorldRenderTag() { } public void Render(RenderStream outputStream, TagProcessor tagProcessor, XmlNode tag, ObjectLoadManager objectLoadManager, PageBuildContext context) { string text = tag.InnerText; if (string.IsNullOrEmpty(text)) { outputStream.WriteLine("Hello World!"); } else { outputStream.WriteLine("Hello {0}!", tag.InnerText); } } } }
<RenderTags> <Tag name="helloworld" typename="HelloWorldRenderTag" namespace="My.CustomRenderTag" filename="<PathToAssembly>\My.CustomRenderTag.dll" />
Source: Developing Custom RenderTags
© copyright 2011 by Dennis Reil