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

Forums / Developing with Sitefinity / Custon blog list template

Custon blog list template

5 posts, 0 answered
  1. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    07 Jul 2011
    Link to this post
    Hi all,

    I'd like to know if I can create a custom bloglist template like I could in SF3.7.
    There I would do it like this:

    1. Create a class that inherits from BlogList.
    2. Override the template path to point to my template.ascx
    3. Write the logic

    How can I do this within SF 4.1? Can I create custom templates that also have a custom class, or maybe code-behind?

    Thanks,
    Daniel
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    07 Jul 2011
    Link to this post
    Hello Daniel Plomp,

    Yes, there's no problem in implementing this functionality with 4.x as well. You can do this globally for the whole site (i.e. the settings will be applied to all blog post widgets) by going to Administration -> settings -> Advanced -> Controls -> ViewMap and click on create new. For Host type fill Telerik.Sitefinity.Modules.Blogs.Web.UI.Public.MasterPostsView
    and in LayoutTemplatePath property you can specify the application-relative path to your template.Click on save and restart the application, this should apply the template globally.
    If you want to do it on a widget level you can click on edit for the particular blog posts widget and navigate to
    ControlDefinition > Views >MasterBlogPostsFrontend. In the TemplatePath property set the app-relative path to your custom template,a nd make usre you have deleted the value set for the TemplateKey property, as it refers to the ID of the currently applied template. I have attached a screenshot demonstrating the location of this property and a sample template I've used.
    For more information you can check this article, it deals with the overall process of mapping templates to widgets in Sitefinity 4.x hope you find it useful.

    All the best,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    07 Jul 2011
    Link to this post
    Hi Boyan,

    Thanks for the help so far!
    I understand the way of using the templates.

    What I don't understand is how I can override the logic of getting the blogdata etc. as I would do that inside SF3.x.
    The solution you offered is also being achieved through the designer, right?

    So, I could create a whole new control and get the data through the API and do all by hand, but something tells me that there should be a more easier way?

    In the end, what I want to achieve is to replace the pager on the blog view with my own. Since I cannot get the pager to work and styled as required, I'm a bit lost in how to do this. So that is why I was thinking of the SF3.x approach.
    I need the pager to appear at the top and the bottom and to be styled in a different way.

    Actually, I did the same thing recently in SF3.x by inheriting the ContentView class.
    This is what I want to achieve: http://redmatters.com/goedezakengids/website/v4/pagina2.html

    Regards,
    Daniel




  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    08 Jul 2011
    Link to this post
    Hi Daniel Plomp,

    Yes, the solution will work form the designer of the widget

    Actually, if it's only the pager control that's bothering you can freely substitute the default one:
    <sf:Pager id="pager" runat="server"></sf:Pager>
    with your custom pager, as long as you register its TagPrefix in the template. Please do not hesitate to let us know if this is not the desired functionality.

    Best wishes,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    10 Jul 2011
    Link to this post
    Hi Boyan,

    Thanks for the reply.
    Would you be so kind to make an example for me?

    I'm not sure how to create a pager which also can correspond with the BlogView?

    I'm just comparing with SF3.x, because there you could override e.g.: CreateDataSource, SetMetaData etc...

    For example: how can I get the 'TotalItems', 'ItemsPerPage', 'TotalPages'?

    Thanks,
    Daniel
5 posts, 0 answered