Mapping External Templates for Sitefinity Widgets
Hi hello!!!
I currently use Virtual Path Provider method to map my custom widget templates. It is explained at http://www.sitefinity.com/blogs/team-blog/2011/05/10/mapping_external_templates_for_sitefinity_4_widgets
However, I prefer to be able to define all my custom templates via ViewMap now and have friendly names for them all.
How can I define the "new" default templates for the widgets I customize?
And, NO, I don't want my users to define the path in Advanced view of the widget designer when they drag&drop them into the pages.
Ideally, just like how "Virtual Path Provider "method works, I like to have the same logic, but with friendly names.
With the ViewMap method I can set up the widgets I know of their hostType. But the problem is I don't know all the options out there.
For example, I created a simple module in Module Builder. Sitefinity automatically registered it in the ToolboxesConfig.config See the excerpt below, irrelevant parts omitted.
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
toolboxesConfig
>
<
toolboxes
>
<
toolbox
name
=
"PageControls"
>
<
sections
>
<
add
enabled
=
"True"
title
=
"HelpDesk"
description
=
"Holds all dynamic content widgets for the helpdesk module."
ordinal
=
"0"
name
=
"Telerik.Sitefinity.DynamicTypes.Model.HelpDesk"
>
<
tools
>
<
add
enabled
=
"True"
type
=
"Telerik.Sitefinity.DynamicModules.Web.UI.Frontend.DynamicContentView, Telerik.Sitefinity"
title
=
"HelpDesk categories"
cssClass
=
"sfNewsViewIcn"
moduleName
=
"HelpDesk"
DynamicContentTypeName
=
"Telerik.Sitefinity.DynamicTypes.Model.HelpDesk.HelpDeskCat"
DefaultMasterTemplateKey
=
"257eade6-4f0c-63e9-ab3b-ff00002e6585"
DefaultDetailTemplateKey
=
"267eade6-4f0c-63e9-ab3b-ff00002e6585"
HideListViewOnChildDetailsView
=
"true"
visibilityMode
=
"None"
name
=
"Telerik.Sitefinity.DynamicTypes.Model.HelpDesk.HelpDeskCat"
/>
<
add
enabled
=
"True"
type
=
"Telerik.Sitefinity.DynamicModules.Web.UI.Frontend.DynamicContentView, Telerik.Sitefinity"
title
=
"HelpDesk pages"
cssClass
=
"sfNewsViewIcn"
moduleName
=
"HelpDesk"
DynamicContentTypeName
=
"Telerik.Sitefinity.DynamicTypes.Model.HelpDesk.HelpDeskPage"
DefaultMasterTemplateKey
=
"877eade6-4f0c-63e9-ab3b-ff00002e6585"
DefaultDetailTemplateKey
=
"887eade6-4f0c-63e9-ab3b-ff00002e6585"
visibilityMode
=
"None"
name
=
"Telerik.Sitefinity.DynamicTypes.Model.HelpDesk.HelpDeskPage"
/>
</
tools
>
</
add
>
</
sections
>
</
toolbox
>
</
toolboxes
>
</
toolboxesConfig
>
So, if I create templates like ~/sfCtrlPresentation/OpenAccessDataProvider,GUID.ascx they would be the new "default" templates the system would use.
How could I define those template paths in ControlsConfig.config file or equally in Advanced Settings > Controls > ViewMap ?
For the same matter, defining templates for Blog posts with the same method is also needed. :)
The closest solution I could find is posted by Drew Reutlinger (Thanks Drew).
http://www.sitefinity.com/developer-network/forums/designing-with-sitefinity/custom-event-view#vF0xGvMz9Uq2p9zuuNZU0w
BTW, this is for Sitefinity 7.1
Thanks,
Osman
Hi Osman,
I believe that we have answered your question in the support ticket you have opened. I am pasting our reply here for your convenience:
Thank you for contacting us.
Can you please refer to the following article for more details on how you can map external widget templates in Sitefinity?
If you would like to map the widget template from the ViewMap you need to create a new ViewMap under Administration -> Settings -> Advanced -> Controls -> ViewMap.
In the HostType field you need to enter the full control type name that you would like to map.
In the LayoutTemplatePath field please you need to write the relative path to your custom template (.ascx file): e.g. ~/UsersListCustom.ascx
For example, if you would like to map template for the Single News Item you need to enter the following HostType: Telerik.Sitefinity.Modules.News.Web.UI.DetailsSimpleView. Please also refer to the screenshot.
For the News List template you need to use the following control type name in the HostType field: Telerik.Sitefinity.Modules.News.Web.UI.MasterListView
You can find the full control types from the default widget's advanced settings. Here is a short video for your convenience.
I hope the above information helps. Please let me know if I can be of further assistance.
Regards,
Sabrie Nedzhip
Telerik