Yesterday we have released Sitefinity 3.6 beta and one of the major new improvements are embedded control templates. By embedding templates we were able to drastically reduce the number of files that comes with Sitefinity website, but even more importantly, we have ensured that on upgrades we do not override your customized templates anymore.
How does it work?
So the question is: if we have embedded templates, does this mean you will not be able to modify templates anymore? Are you stuck with whatever template we have embedded? No, of course not.
When you wish to change a template, you can map the view (view is technically just a control, but there is a difference here in this new way of thinking of controls, that I will elaborate on in one of the future posts) to use external template instead of the embedded one.
How to map a view to an external template?
First thing we need to do is add controls configuration file. To do so, do following:
While you have this declaration in this config file, Sitefinity will always use your external template as opposed to an embedded one. When you upgrade, Sitefinity will not come with any template files so there is no risk of losing your modifications.
- Create a new folder in App_Data folder and name it Configuration
- Create a new file in Configuration folder and name it Telerik.Sitefinity.Configuration.ControlsConfig.xml
- Set following XML in the file in order to map ContentItemNew view to use your external template:
|<?xml version="1.0" encoding="utf-8" ?> |
| <viewMap> |
| <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemNew`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine, Version=3.1.3311.24714, Culture=neutral, PublicKeyToken=85fd314cb21bc432]]" |
| </viewSettings> |
| </viewMap> |
- Create the file for your external template and that is it.
How do you know hostType of the view you want to change?
You don’t. In Sitefinity 3.6 we will ship reference files of all views and their types for your convenience so you can easily copy and paste viewSettings declaration for the files you wish to change. While we believe this new feature is quite powerful and will solve many problems, we are aware that it is far away from a “user friendly”, therefore in Sitefinity 4.0 we will provide a graphical user interface for managing views.
I do not want to write the template from the scratch – I just want to modify it
Understandably, since templates will be embedded, how do you only modify a template. Once again, for the transition period between 3.6 and 4.0 we will provide all templates in a separate zip file, so that you can simply pull a template you need, modify it and map a view to it. In Sitefinity 4.0 template exporter tool is planned which will be part of the same graphical user interface for mapping views to external templates.
You can download the files I’ve talked about in this post from here.
Stay tuned for more posts about Sitefinity 3.6 beta.