+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Editing Comments Template

Editing Comments Template

13 posts, 1 answered
  1. andersleet
    andersleet avatar
    155 posts
    Registered:
    03 Jun 2009
    14 Jul 2009
    Link to this post
    Hi all,

    I have a page with video control on it. I want to change how the comment box looks, but cannot seem to find where the template is to do so. Anyone know where I should start?

    Thanks!
    anders
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    14 Jul 2009
    Link to this post
    Hello andersleet,

    Thank you for using our services.

    You can find a template for the public view of CommentsList control in the following folder: ~/Sitefinity/ControlTemplates/GenericContent/CommentsList.ascx. You can create your version of the comments list template from this one. Note that the the box used for writing the comment is actually a stripped down RadEditor. Basically you can change this editor as you wish. After you have editted the template you have to open the template for your video control (the template for single items to be more precise). There at the very bottom you will find the tag for the CommentsList cotnrol. You will have to provide the path to your template like this:
    <div id="comments" class="sf_contentComments"
    <sfWeb:CommentsList ID="commentsList" runat="server" CssClass="sf_commentsList"
             LayoutTemplatePath
    ="~/Path to your template"
    </sfWeb:CommentsList> 
    </div> 

    Do not forget to map the path to the single video template in order to see the changes in the CommentsList template.

    I hope that this information will help you. If you have further questions do not hesitate to contact us.

    Regards,
    Rado
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
    Answered
  3. Klemen Slavič
    Klemen Slavič avatar
    30 posts
    Registered:
    24 Jul 2009
    25 Nov 2010
    Link to this post
    I'm having some problems with this control's layout template; I've set the LayoutTemplatePath, but the control won't update to the new layout template.

    Specifically, I've located the CommentsList control at the bottom of the single event item view and used the following code:

    <div id="comments" class="sf_contentComments">
        <sfWeb:CommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo" LayoutTemplatePath="~/Sitefinity/ControlTemplates/Generic_Content/CommentsList.ascx" />
    </div>

    The file is there (I've noticed that you used GenericContent instead of Generic_Content) as is shown in the attachement.
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    25 Nov 2010
    Link to this post
    Hello Klemen Slavič,

    The path is not relevant here, it might have been a typo in my response. Can you please make sure that you have mapped the control template for the parent control you are editing. If it is NewsView you have to map the control template for news view in controls config file and restart the website.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Klemen Slavič
    Klemen Slavič avatar
    30 posts
    Registered:
    24 Jul 2009
    25 Nov 2010
    Link to this post
    The EventsView control has the ItemListTemplatePath and SingleItemTemplatePath set to the appropriate templates; those I've taken from the external templates provided in the Sitefinity downloads section.

    I've verified it actually uses those templates by writing in some HTML that is displayed on the page, so I'm positive it is using those templates. However, even after settings the LayoutPathTemplate property on the CommentsList control in SingleItemTemplatePath template, I'm getting the default CommentsList.
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    25 Nov 2010
    Link to this post
    Hi Klemen Slavič,

    Please inspect the attached sample project.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Klemen Slavič
    Klemen Slavič avatar
    30 posts
    Registered:
    24 Jul 2009
    26 Nov 2010
    Link to this post
    Are you referring to the ~/Sitefinity/Admin/ControlTemplates/Events/Modes/ListPageDetail.ascx control? That is the only one I've found inside the project that uses the LayoutTemplatePath property.

    The declaration seems pretty much identical to what I'm using:

    <sfWeb:CommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo" LayoutTemplatePath="~/Sitefinity/ControlTemplates/Generic_Content/CommentsList.ascx" />


  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Nov 2010
    Link to this post
    Hello Klemen,

    Please take a look at attached video.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Klemen Slavič
    Klemen Slavič avatar
    30 posts
    Registered:
    24 Jul 2009
    28 Nov 2010
    Link to this post
    I've stepped through the video and checked the parameters. As it stands, I have done the following:

    1. I've put an EventsView control on the page
    2. I've configured the control templates to point to ~/Sitefinity/ControlTemplates/Events/ContentViewSingleItem.ascx (single item) and ~/Sitefinity/ControlTemplates/Events/ContentViewContentItem.ascx.
    3. I've verified that the control uses the two templates by putting in markers before and after the <sfWeb:CommentsList /> server control
    4. I've set the CommentsList LayoutTemplatePath property to ~/Sitefinity/ControlTemplates/Generic_Content/CommentsList.ascx and modified the template to display some custom HTML:

    The relevant part of the EventsView single item template now looks like this:

    ---start---
    <sfWeb:CommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo" LayoutTemplatePath="~/Sitefinity/ControlTemplates/Generic_Content/CommentsList.ascx" />
    ---end---

    In the event page single item view I can see the ---start--- and ---end--- markers, but the control seems to ignore the LayoutTemplatePath, since it's not displaying the template, instead showing the default.

    Also, the project I'm working on started as a fork of the Summer theme, if that has any impact on the matter.
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    28 Nov 2010
    Link to this post
    Hello Klemen,

    1. Please make sure that you use the latest version of Sitefinity - 3.7 SP4.

    2. As you can see we cannot replicate this issue locally or using our demo website. If you want you can open a support request and attach a sample project which we can use to debug.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Klemen Slavič
    Klemen Slavič avatar
    30 posts
    Registered:
    24 Jul 2009
    29 Nov 2010
    Link to this post
    I've found the error that prevented me from using the correct comments template.

    When using the CommentsList control in the following way, it doesn't work:

    <sfWeb:CommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo" LayoutTemplatePath="~/Sitefinity/ControlTemplates/Generic_Content/CommentsList.ascx" />

    ...whereas this works:

    <sfWeb:CommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" LayoutTemplatePath="~/Sitefinity/ControlTemplates/Generic_Content/CommentsList.ascx" ValidationGroup="commentInfo" />

    The only change is the ordering of LayoutTemplatePath and ValidationGroup attributes. Is this a bug?
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Nov 2010
    Link to this post
    Hello Klemen,

    The control uses custom validation that is initialized inside CommentsList control. If the validation fails, InitializeControls method also fails.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Klemen Slavič
    Klemen Slavič avatar
    30 posts
    Registered:
    24 Jul 2009
    29 Nov 2010
    Link to this post
    Does that mean that if validation fails, no comments and form are shown, or does that mean that it falls back to using the default control template?

    Just to clear things up, since I don't know how the ordering of the attributes actually affects the validation and/or template rendering in this case.
Register for webinar
13 posts, 1 answered