Mapping news detail control to custom template
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:
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?
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.
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?
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)
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?
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.