Sitefinity 3.6 beta - Mapping views to use external templates

Sitefinity 3.6 beta - Mapping views to use external templates

January 24, 2009 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

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:
  1. Create a new folder in App_Data folder and name it Configuration
  2. Create a new file in Configuration folder and name it Telerik.Sitefinity.Configuration.ControlsConfig.xml
  3. Set following XML in the file in order to map ContentItemNew view to use your external template:
    <?xml version="1.0" encoding="utf-8" ?> 
    <controlsConfig> 
     <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]]"  
    layoutTemplatePath="~/Sitefinity/MyTemplates/Admin/ContentItemNew.ascx"
        </viewSettings> 
      </viewMap> 
    </controlsConfig> 
     
  4. Create the file for your external template and that is it.
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.

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.
progress-logo

The Progress Guys

View all posts from The Progress Guys on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments
Comments are disabled in preview mode.
Topics
 
 
Latest Stories in
Your Inbox
Subscribe
More From Progress
d12fcc0bdb669b804e7f71198c9619a7
5 Questions Automakers Should Ask to Improve Asset Uptime
Download Whitepaper
 
SF_MQ_WCM
2018 Gartner Magic Quadrant Web Content Management (WCM)
Download Whitepaper
 
What-Serverless-Means-For-Enterprice-Apps-Kinvey
What Serverless Means for Enterprise Apps
Watch Webinar