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

Forums / Developing with Sitefinity / Mapping news detail control to custom template

Mapping news detail control to custom template

6 posts, 0 answered
  1. Haroon
    Haroon avatar
    8 posts
    Registered:
    27 Nov 2014
    20 Mar 2015
    Link to this post

    I am trying to map the detail control in the news widget to a custom template using ControlsConfig.config.

    I have added the following to the file:

    <viewSettings layoutTemplatePath="~/WebsiteTemplates/MySiteTemplate/WidgetTemplates/NewsArticle.ascx" hostType="Telerik.Sitefinity.Modules.News.Web.UI.DetailsSimpleView, Telerik.Sitefinity.ContentModules" />

    However the widget is still using the built-in template. I have tried adding the layout template path to the widget instead using Home -> ControlDefinition -> Views ->NewsFrontendDetails -> TemplatePath in the advanced widget settings and this does work (but is not an ideal solution). Do I need to use a different host type in the config file?

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    25 Mar 2015
    Link to this post
    Hi Haroon,

    You can check the documentation articles here and here for more information about using template editor and external template file.

    I hope this information helps.

    Regards,
    Svetoslav Manchev
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Haroon
    Haroon avatar
    8 posts
    Registered:
    27 Nov 2014
    25 Mar 2015
    Link to this post

    Hi Svetoslav,

    As mentioned I have already mapped the template using the technique in your second link (the widget TemplatePath field), but this isn't an ideal solution as it needs to be set every time a widget is added. I also prefer not to use the method in the first link as I like to keep templates in external files rather than editing the built-in ones.

    I have mapped other widget templates already using ControlsConfig.config and they do work (including the news list template), it is only the news detail one that does not. Is there a problem with the hostType I'm using?

  4. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    30 Mar 2015
    Link to this post
    Hello Haroon,

    Try to use the View map under:
    Administration > Settings > Advanced > Controls > ViewMap > Create New (screenshot)
    HostType: Telerik.Sitefinity.Modules.News.Web.UI.DetailsSimpleView, Telerik.Sitefinity.ContentModules
    LayoutTemplatePath: ~/Widgets/CustomNewsDetails.ascx (the path to your control)


    Regards,
    Svetoslav Manchev
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  5. Haroon
    Haroon avatar
    8 posts
    Registered:
    27 Nov 2014
    31 Mar 2015 in reply to Svetoslav Manchev
    Link to this post

    That view map already exists since those settings write the data to the same ControlsConfig.config file I have already used - removing it from the file and re-entering it through the advanced settings menu just updates the file with the same data. The template still does not map to the news detail view at all.

    I have used the same technique for the list view and that does work, which is why I suspect the mapping itself (host type) may be wrong, or perhaps the news widget is not using it correctly?

  6. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    03 Apr 2015
    Link to this post
    Hi Haroon,

    This should works. Here is a screenshot of my test.

    Please check if the HostType and LayoutTemplatePath are correct and ensure that the the application is restarted.

    Regards,
    Svetoslav Manchev
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
6 posts, 0 answered