Forum Images in Preview Transformation - Intranet

Katrina Miday asked on February 24, 2014 08:20

I have an intranet and it was requested that the images added to forum posts be displayed in the list of posts preview.

I've gotten the images to display using CMS.CMSHelper.CMSContext.ResolveDiscussionMacros (string) but this then causes all other HTML to display as plaintext one way or another within the transformation.

Code I have tested so far:

<div class="Latest">
<h4><a href="<%# ForumFunctions.GetPostURL(Eval("PostIDPath"), Eval("PostForumID")) %>"><%# ((String)Eval("PostSubject", true)).ToUpper() %></a> | <%# GetDateTime("PostTime").ToUpper() %></h4>
<div class="Summary">
  <b>Eval Post Text:</b>
    <%# Eval("PostText") %><br />
  <b>HTML Encode Limit Post Text:</b>
    <%# HTMLEncode(LimitLength(Eval("PostText"), 300, "...")) %><br />
  <b>No HTML Encode:</b>
    <%# LimitLength(Eval("PostText"), 300, "...") %><br />

  <b>Resolve Discussion Macro:</b>
    <%# CMS.CMSHelper.CMSContext.ResolveDiscussionMacros("" + Eval("PostText") + "") %><br /><br />
  <b>Limit Resolve post text:</b>
  <%# LimitLength(CMS.CMSHelper.CMSContext.ResolveDiscussionMacros("" + Eval("PostText") + ""), 500, "...") %><br /><br />
  <%# CMS.CMSHelper.CMSContext.ResolveDiscussionMacros("" + HTMLEncode(LimitLength(Eval("PostText"), 300, "...")) + "") %><br /><br /><br />
  <%# LimitLength(StripTags(RemoveDynamicControls(CMS.CMSHelper.CMSContext.ResolveDiscussionMacros("" + Eval("PostText")+ ""))), 100, "...") %>
</div>
<br class="Clear" />
</div>

Screenshot:

Screenshot

Recent Answers


Juraj Ondrus answered on March 25, 2014 02:19

Hi,

Just an update on this. I am using this transformation from the sample Corporate site and it is working fine:

<a href="<%# ForumFunctions.GetPostURL(Eval("PostIDPath"), Eval("PostForumID")) %>"><%# Eval("PostSubject", true) %></a>
<%# CMS.CMSHelper.CMSContext.ResolveDiscussionMacros("" + Eval("PostText") + "") %>

Best regards,
Juraj Ondrus

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.