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

Forums / Designing with Sitefinity / Blog Display - Latest Full Entry, then list

Blog Display - Latest Full Entry, then list

2 posts, 0 answered
  1. Jason Green
    Jason Green avatar
    53 posts
    Registered:
    18 Sep 2009
    10 Mar 2010
    Link to this post
    I am trying to add a blog to a site where the latest entry is shown in full and the following 6 or 10 titles are shown below.

    I was able to almost do this using two blog controls.  One set to display "One Per Page" with no paging and the other set to display "List and Page".  When setup this way, the main blog (One Per Page) show just fine, but that same entry is reshown in the "List and Page" listing.  Also, when one of the list per page entries is selected, the blog entry shows twice - once in the "One Per Page" entry, and again when the "List and Page" tries to show it again.

    Is there an easy way to set this up with the Blog Controls out of the box?

    Like this:

    ---------------------------------------------
        LATEST BLOG ENTRY
    [FULL DISPLAY]
    ---------------------------------------------
    [social links] 

    | 2nd Entry Title    [full story]

    | 3rd Entry Title    [full story]

    | 4th Entry Title    [full story]

    | 5th Entry Title    [full story]

    1  2  3  4  5  Next Page

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    10 Mar 2010
    Link to this post
    Hello Jason Green,

    You need a custom control to do this. It is not possible to set start and end index to the data list of the default BlogPosts control.

    You need a custom class that inherits from BlogPosts.

    1. You need to exclude the first item from the list to which the control is bound.
    2. You need to get the first item of all items and show this item in detail mode.

    Below is a sample code that illustrates how to achieve this

    public class BlogPostsCustomControl : BlogPosts
    {
        public BlogPostsCustomControl()
        {
        }
         public override string  SingleItemTemplatePath
         {
         get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Blogs/Modes/ListPageDetail.ascx";
            }
         
         }
     
        public override string  ItemListTemplatePath
        {
            get
            {
             return "~/Sitefinity/Admin/ControlTemplates/Blogs/Modes/ListPageMaster.ascx";
            }
        }
     
      
        protected override IList CreateDataSource()
        {
            ContentManager blogsManager = new ContentManager("Blogs");
            // this will bind the control from the second item not from the first one.
            return blogsManager.GetContent(1, 100, "Publication_Date DESC");
        }
     
        protected override void CreateChildControls()
        {
            ContentManager blogsManager1 = new ContentManager("Blogs");
            IList allitems = blogsManager1.GetContent(0, 100, "Publication_Date DESC");
            IContent firstItem = allitems[0] as IContent;
            ContnetItemID = firstItem.ID;
            base.CreateChildControls();
            
        }
     
     
        public Guid ContnetItemID
        {
            get
            {
                return this._itemID;
            }
            set
            {
                this._itemID = value;
            }
        }
        private Guid _itemID;
     
    }


    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.
2 posts, 0 answered