Wednesday, September 17, 2014

Sitecore Branch Template Example

A 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.

Following tokens can be used in field values of each of the items inserted using branch template.

Token
Value
$name
The name entered by the user when inserting the item
$id
The ID of the item
$parentid
The ID of the parent of the item
$parentname
The name of the parent of the item
$date
The system date (yyyyMMdd)
$time
The system time (HHmmss)
$now
The date and time (yyyyMMddTHHmmss)


Following example creates a branch template, which can be used to create a “Shopping” item with two folders “Brands” and “Products” and each folder with a respective sample item.
















Step 1: Create three templates “Shopping”, “Brand” & “Product” with “Title” & “Description” fields











Step 2: Create a new Branch. Navigate to “sitecore/templates/Branches” , right click and insert “ New Branch”




Step 3: Select “Shopping” template in the “Create a New Branch” branch template wizard


























Step 4: Right click on $name and create two new folders “Brands” & “Products”


























Step 5: Right click on “Brands” folder and create a sample item using “Brands” template. Then create a sample item using “Products” template under “products” folder.

















Step 6: Right click on Home and create a content item from the new branch template.


11 comments:

  1. This is the nice article on
    sitecore please keep Sharing

    ReplyDelete
  2. Nice blog. Really helpful for learning SiteCore and keep update on some more tutorials….. I liked your blog.

    ReplyDelete
  3. This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points. To appreciate this I like to share some useful information.mobile application testing training in bangalore

    ReplyDelete
  4. Information in this blog is very useful for me, I am very happy to part of this blog
    Sitecore Online Training
    Sitecore Training in Hyderabad

    ReplyDelete
  5. Thanks for sharing this article . Turkey visa US is a visa which is made specifically for citizens of the USA and this exactly the type of article I was looking for

    ReplyDelete