Gets the template of the item.
A template defines the schema of an item. A schema describes which fields an item has and may contain default values for the fields, for instance a layout definition. Fields are grouped into sections that describe related fields. Templates supports inheritance.
This example gets the names of the subitems that has the Document template.
public string GetDocumentNames() {
string result = "";
Item item = Sitecore.Context.Database.Items["/sitecore/content/Home"];
foreach(Item child in item.Children) {
if (child.Template.Name == "Document") {
result += child.Name + ",";
}
}
return result;
}
Item Class | Sitecore.Data.Items Namespace