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

Forums / Developing with Sitefinity / How to retrive number of comment, Taglist and categories of blogpost

How to retrive number of comment, Taglist and categories of blogpost

2 posts, 0 answered
  1. Pravat
    Pravat avatar
    59 posts
    Registered:
    22 Jun 2010
    30 Aug 2011
    Link to this post
    Hi Team,
                  How to retrive Comment count, Categories list and Tagslist from blog post in my custom template. I want post should display like below. Please provide some sample template.

    'Title of Blog post'
    05/18/11 | 10 Comments | Tags: Natural Gas, South Africa, Mpumalanga plant

    Please help..

    Thanks & Regards,
    Pravat sharma.
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    02 Sep 2011
    Link to this post
    Hello Pravat,

    The comments count is displayed via a CommentsBox control, and for the Tags, you will need to add a FlatTaxonField control on your template. Basically this:
    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Comments" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Import Namespace="Telerik.Sitefinity" %>   
     
    <telerik:RadListView ID="Repeater" ItemPlaceholderID="ItemsContainer" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
        <LayoutTemplate>
            <sf:ContentBrowseAndEditToolbar ID="MainBrowseAndEditToolbar" runat="server" Mode="Add"></sf:ContentBrowseAndEditToolbar>
            <ul class="sfpostsList sfpostListTitleDateContent">
                <asp:PlaceHolder ID="ItemsContainer" runat="server" />
            </ul>
        </LayoutTemplate>
        <ItemTemplate>
            <li class="sfpostListItem">
                 
                <h2 class="sfpostTitle">
                    <sf:DetailsViewHyperLink TextDataField="Title" ToolTipDataField="Description" runat="server" />
                </h2>
                 
                <div class="sfpostAuthorAndDate">
                    <asp:Literal ID="Literal2" Text="<%$ Resources:Labels, By %>" runat="server" />
                    <sf:PersonProfileView runat="server" />
                    <sf:FieldListView ID="PostDate" runat="server" Format=" | {PublicationDate.ToLocal():MMM dd, yyyy}" />
                </div>
     
                <sf:FieldListView ID="PostContent" runat="server" Text="{0}" Properties="Content" WrapperTagName="div" WrapperTagCssClass="sfpostContent" />
     
                <sf:CommentsBox ID="itemCommentsLink" runat="server" CssClass="sfpostCommentsCount"/>
                 
                
                <div class="sfpostCategoriesAndTagsWrp">
                    <sitefinity:FlatTaxonField ID="FlatFieldControl" DisplayMode="Read" BindOnServer="true" runat="server" TaxonomyId="CB0F3A19-A211-48a7-88EC-77495C0F5374" WebServiceUrl="~/Sitefinity/Services/Taxonomies/FlatTaxon.svc" Expanded="false" TaxonomyMetafieldName="Tags" Title="Tags" ResourceClassId="TaxonomyResources" HideWhenNoTaxaFound="true" CssClass="sfpostTagsWrp" />
                </div>
                
                <sf:ContentBrowseAndEditToolbar ID="BrowseAndEditToolbar" runat="server" Mode="Edit,Delete,Unpublish"></sf:ContentBrowseAndEditToolbar>
            </li>
        </ItemTemplate>
    </telerik:RadListView>
    <sf:Pager id="pager" runat="server"></sf:Pager>
    would display all the necessary infoprmation for your use case scenario, the rest should be some CSS styling (position:relative float:left) to display the tags and comments count on one line. This forum thread contains a discussion and code sample on a similar implementation, I believe you might find it useful.


    Greetings,
    Boyan Barnev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

2 posts, 0 answered