Wednesday, September 28, 2016

How Use Branch Templates in Sitecore CMS

Hi All,
Today we discuss about Branch template in sitecore.
At first question come in mind what is Branch template.

Template defines the fields and sections associated with a type of item. Items in sitecore can be created using three different template types.

·         Data Template:  form the framework around which items are built. They define fields used to control how data is entered and can inherit from other templates to enable reuse.

·         Branch Template: allow you to create a set of items rather than a single item at a time.

·         Command Template: allow insert of items according to logic rather than predefined structures.

Data Template: A data template defines a data type. Sitecore associates a data template with each item. The data template defines the structure of all items associated with that data template. A data template contains a number of data template sections, each of which contains a number of data template fields.

Branch Template: A branch template consists of a branch template definition item, which can contain a single item, a hierarchy of items, or multiple hierarchies of items. When a user invokes a branch template, Sitecore duplicates the item(s) beneath the branch template definition item, including any field values, and then performs token substitution on item names and field values.

Steps for creating brach template:
1. At first navigate to "/sitecore/templates/User Defined" or "/sitecore/templates" create a template which is the base for branch template or either you can select folder(/sitecore/templates/Common/Folder) for that as well if you don't wanna create any template for that.
In my case I create a "Website Base" template that inherit the base template of website and give the blue folder icon that give unique look to my branch template.



2. Then navigate to "/sitecore/templates/Branches/User Defined"
3. Under this node either create new branch template directly or create a separate folder then create branch template inside.
4. Right click and select "New Branch" option.
5. Select the template for that in my case "Website Base" or if you don't create any then select Folder(/sitecore/templates/Common/Folder).
6. A new branch template item will have been created including a Website Base item name $name.
7. $name is token that is replaced by selected name when branch template used.
8. Under $name item create a tree structure that you wanna create from branch template.

9. For creating item under sitecore/content node, right click and select insert from template.
10. navigate to branch template and select that and give suitable name. A tree structure as you described in branch template automatically created. 


Here are the helpful links:
https://www.geekhive.com/buzz/post/2015/02/how-to-create-branch-templates-in-sitecore-cms/
http://sitecoreworld.blogspot.in/2014/09/sitecore-branch-template-example.html



No comments:

Post a Comment