Creating and editing widget templates

Creating a new widget template

  1. Go to Sitefinity’s backend (http://<yoursite>/sitefinity)
  2. In the main menu, click Design » Widget Templates.
  3. Click Create a template.
  4. 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 postssingle.
  5. In the text area, write your code for the template.
  6. 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.

  7. To add the sample code, in the text area, click Insert.
  8. When you have entered the code, in Template name field, enter name of your template.
  9. 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

  1. In the main menu, click Design » Widget Templates.
  2. In the text area, write your code for the template.
  3. 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.

  4. To add the sample code, click Insert.
  5. When you are finished, click Save changes.

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK