Mapping news detail control to custom template

Posted by Community Admin on 04-Aug-2018 14:16

Mapping news detail control to custom template

All Replies

Posted by Community Admin on 20-Mar-2015 00:00

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?

Posted by Community Admin on 25-Mar-2015 00:00
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
 
Posted by Community Admin on 25-Mar-2015 00:00

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?

Posted by Community Admin on 30-Mar-2015 00:00
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
 
Posted by Community Admin on 31-Mar-2015 00:00

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?

Posted by Community Admin on 03-Apr-2015 00:00
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
 
This thread is closed