Support
/ Knowledge Base
/ How to map a view to an external template, in Sitefinity 3.6 or later?
How to map a view to an external template, in Sitefinity 3.6 or later?
How to map a view to an external template in Sitefinity
In Sitefinity 3.6, we introduced the Embedded Controls approach. This is preventing the Control template overriding issue.
Problem:
How to use an external template, instead of the embedded one that Sitefinity uses by default? How to customize an embedded template?
Solution:
First thing we need to do is to add a controls configuration file. To do so, please follow these steps:
1. Create a new directory in the App_Data directory and name it Configuration
2. Create a new file in the Configuration directory and name it Telerik.Sitefinity.Configuration.ControlsConfig.xml
3. Set following XML in the file in order to map NewsItemNew view to use your external template:
Create the file for your external template. In this case, the file should be located at ~/Sitefinity/Admin/ControlTemplates/News/NewsItemNew.ascx
While you have this declaration in this config file, Sitefinity will always use your external template as opposed to the embedded one.
You can find a complete reference for all Views (controls) in the ControlsConfigReference.xml which you will find in Sitefinity_3_6_1870_[standard]/[community]_ExternalTemplates.zip file. It can be downloaded from your Client.Net accounts.
Important: external templates require external resource files. When you find the template which will be mapped to be used externally, locate its resource file and add it to the module that uses the template. Example, if the external template is ~/Sitefinity/Admin/ControlTemplates/News/NewsItemNew.ascx , its resource file should be: ~/Sitefinity/Admin/ControlTemplates/News/App_LocalResources/NewsItemNew.ascx.resx . You could find the corresponding resource files in the External Templates zip file available for download in MyClient.net .
If you do not want to create a template from scratch, you can take the template you want to customize from the same archive. Then you should point Sitefinity to the customized template, like we did in step 2.
If you want to map the front end templates, you could simply set the path to the external template in the necessary control property (Edit Control -> Appearance).
Note: Please do not copy and paste the ControlsConfigReference.xml from the zip archive to your project. Take only these mapping and templates you need.
Here is an interesting case though. What do you do, if you have several content providers? How to map the controls for the other providers you use? Here's the solution:
The key property holds the provider name.
When you map the necessary view, the application should be restarted.
Please submit a forum or support thread, if you have any problems or need further information about that.
Article Info
Article relates to Sitefinity 3.6, Sitefinity 3.7
Created by Georgi Chokov
Last modified by Georgi Chokov
Related categories:
General