Creating and editing widget templates
Creating a new widget template
- Go to Sitefinity’s backend (http://<yoursite>/sitefinity)
- In the main menu, click Design » Widget Templates.
- Click Create a template.
- In the This template is applied to... dropdown box, select the widget for which you want to create a template
For example if you want to create new template for the single post item view of the blogs, select Blogs posts – single.
- In the text area, write your code for the template.
- To insert a property field of the widget, in the template, click the desired field in the right menu.
A window displaying the syntax of the field appears.
NOTE: All custom fields you have created for the content type you have chosen in This template is applied to..., appear under Other data node.
- To add the sample code, in the text area, click Insert.
- When you have entered the code, in Template name field, enter name of your template.
- To save your work, click Create this template.<
NOTE: For your widget template to work properly, you need some specific declarations. For example, the Document – Single template must have the following declarations:
<%@ Control Language="C#" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
<%@
Register Assembly="Telerik.Sitefinity"
Namespace="Telerik.Sitefinity.Modules.Libraries.Web.UI.Documents"
TagPrefix="sfLibraries" %>
To find the correct declarations for your template you can go and
edit some of the templates that are coming with Sitefinity.
Editing an existing widget template
- In the main menu, click Design » Widget Templates.
- In the text area, write your code for the template.
- To insert a property field of the widget, click the desired field in the right menu.
A window displaying the syntax of the field appears.<
NOTE: All custom fields you have created for the content type you have chosen in This template is applied to..., appear under Other data node.
- To add the sample code, click Insert.
- When you are finished, click Save changes.
Related topics:
Feedback