Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Default UGC TBB Code, I hope will be very usefull for you.</p> <pre><code>namespace Tridion.Ugc.Templating.DefaultTemplates { using System; using Tridion.ContentManager; using Tridion.ContentManager.Templating; public static class Helper { public static ApplicationData GetApplicationData(Engine engine, Package package) { IdentifiableObject obj2 = engine.GetObject(package.GetByType(engine.PublishingContext.ResolvedItem.IsComponentPresentation ? ContentType.Component : ContentType.Page)); ApplicationData data = obj2.LoadApplicationData("ugc:ComponentAndPage"); if (data == null) { TemplatingLogger.GetLogger(typeof(EnableUgcProcessing)).Warning(string.Format("No UGC application data for {0} found, UGC output will be disabled", obj2.Id)); } return data; } } } namespace Tridion.Ugc.Templating.DefaultTemplates { using System; using System.Text; using System.Xml; using Tridion.ContentManager; using Tridion.ContentManager.Templating; using Tridion.ContentManager.Templating.Assembly; [TcmTemplateTitle("Enable User Generated Content Processing")] public class EnableUgcProcessing : ITemplate { public void Transform(Engine engine, Package package) { ApplicationData applicationData = Helper.GetApplicationData(engine, package); bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; string innerText = null; string str2 = null; if (applicationData != null) { XmlDocument document = new XmlDocument(); document.LoadXml(Encoding.Unicode.GetString(applicationData.Data)); XmlNode node = document.SelectSingleNode("*/allowtocomment"); if (node != null) { flag = XmlConvert.ToBoolean(node.InnerText); } node = document.SelectSingleNode("*/showcomments"); if (node != null) { flag2 = XmlConvert.ToBoolean(node.InnerText); } node = document.SelectSingleNode("*/allowtorate"); if (node != null) { flag3 = XmlConvert.ToBoolean(node.InnerText); } node = document.SelectSingleNode("*/showunmoderatedcomments"); if (node != null) { flag4 = XmlConvert.ToBoolean(node.InnerText); } node = document.SelectSingleNode("*/sortcomments/field"); if (node != null) { innerText = node.InnerText; } node = document.SelectSingleNode("*/sortcomments/direction"); if (node != null) { str2 = node.InnerText; } } Tridion.ContentManager.Templating.Item item = package.CreateStringItem(ContentType.Text, flag.ToString()); package.PushItem("allowtocomment", item); item = package.CreateStringItem(ContentType.Text, flag2.ToString()); package.PushItem("showcomments", item); item = package.CreateStringItem(ContentType.Text, flag3.ToString()); package.PushItem("allowtorate", item); item = package.CreateStringItem(ContentType.Text, flag4.ToString()); package.PushItem("showunmoderatedcomments", item); if (innerText != null) { item = package.CreateStringItem(ContentType.Text, innerText); package.PushItem("sortcommentsby", item); } if (str2 != null) { item = package.CreateStringItem(ContentType.Text, str2); package.PushItem("sortdirection", item); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload