What are items?

Items are custom content containers which can be used for a number of purposes:

  • To create custom page types and custom paragraph types
  • To add custom settings to e.g. websites and pages

Items are created from a kind of template called an item type which consis of:

  • A set of fields for storing data and
  • A number of settings controlling things like:
    • Where the item type can be used - e.g. only on a specific website or under a specific item type
    • What the item type is supposed to be - e.g. a page, a paragraph, settings

As you may know, a standard paragraph consists of a limited set of standard fields - a header, a text field, an image field and related settings.

In contrast, an item type can have as many fields as needed (Figure 1.2)...

Figure 1.2 An Item type can have as many item fields as you need...

...or indeed as few fields as needed (Figure 1.3).

Figure 1.3 ...or as few!

Items can be used for two things:

  • Creating custom content types, with exactly the fields required for a particular kind of content, e.g. a newsletter, a blog post, etc.
  • Creating custom settings for e.g. websites, pages, users, etc.

Content-focused item types can be restricted, so they are only available on a particular website or as children of another item type. This provides you with many options for creating specialized content structures, for example:

  • A page item type called Parent which can only have a paragraph item type called Child as children
  • A page item type called List which can have three types of page items as children; News article, Blog post, & Case
  • A paragraph item with fields for selecting how many columns the content should be rendered in

Settings-focused item types are used directly on e.g. a website to extend existing settings. Dynamicweb Rapido v. 3.x uses item fields to configure almost everything on the solution (Figure 2.1).

Figure 2.1 Rapido uses website settings to make solutions configurable

Item types are created from the Dynamicweb backend:

  • Go to Settings > Item types
  • Click New Item type and fill in basic settings (name, what it’s going to be used for, etc.)
  • Add any number of item fields – text fields, checkboxes, etc.
  • Define the item restrictions – where the item may be used, which children it can have, etc.
  • Save

Once an item type has been created it can be immediately used for whatever purpose it has:

  • Content-focused item types can be used to create custom content where the item settings & restrictions permit it.
  • Settings-focused item types can be applied where intended, and values can be entered into the fields and saved

See the Item Types article for a more in-depth description of how to create item types.

When an item type used as a custom content type has been created it is immediately available everywhere specified in the item restrictions. Create a new page or paragraph in the usual manner and select the item type when prompted (Figure 4.1).

Figure 4.1 Creating a content-item

The fields of the selected item type can then be filled out and saved, and you have created an item (Figure 4.2).

Content-focused items can also be created from frontend using the item creator app – and edited using the item publisher app.

Item types being used to create custom settings are applied by opening the website settings and using the Item type tool to select the item type (Figure 5.1).

Figure 5.1 Using a settings-focused item type

Once selected, the item type fields are available below the regular page or website properties (Figure 5.2).

Figure 5.2 Item fields will appear below the standard website or page properties

If the item is used to extend user groups and users with custom fields you can apply them in the following way:

  • Open a user or user group
  • Press the Item type button in the ribbon bar and select the item type (Figure 6.1)
  • Click OK
Figure 6.1 User & User group items

When an item is applied at the user level only that user will have the extra fields. When applied at the user group level, all users in the group will have the extra fields.

You may also consider using standard custom user fields.

Item field values can be shown or reacted to in frontend whenever you are in the appropriate context (TemplateTags) or the ViewModel supports it:

For TemplateTags-based designs:

  • Website setting values are available in the master template using Item.Area.{fieldsystemname} tags
  • Page property values are available in page templates using Item.Page.{fieldsystemname} tags
  • Content item values are available in page or paragraph templates using Item.{fieldsystemname} tags

For ViewModel-based designs you have access to an ItemViewModel which allows you to access item properties via e.g. @Model.Area.Item (website settings) or @Model.Item (content items).

As you can see, this means that each content item type will usually requite a matching page or paragraph template – they can be selected for the page in the standard manner, but you can also set default templates for an item type from the Layout tab under website settings.

Items can also be published using the Item Publisher app or the query publisher app – in which case the app templates control how the item is rendered.

database

There is no database specific information for this subject.

ItemList

Defines which item type (ItemListItemType) is used for a given item list (ItemListId

Field name Data type Length
ItemListId int 4
ItemListItemType nvarchar 255
ItemListIsChangedOnLanguage bit 1

ItemListRelation

Links instances of items (ItemListRelationItemId) to an item list (ItemListRelationItemListId) and keeps track of sorting within that item list (ItemListRelationSort).

Field name Data type Length
ItemListRelationId int 4
ItemListRelationItemListId int 4
ItemListRelationItemId nvarchar 255
ItemListRelationSort int 4

ItemNamedItemList

Contains data on named item lists (ItemNamedItemListName) as defined in backend page properties.

Field name Data type Length
ItemNamedItemListId int 4
ItemNamedItemListName nvarchar 255
ItemNamedItemListSourceType nvarchar 50
ItemNamedItemListSourceId bigint 8
ItemNamedItemListItemListId int 4

ItemType_Database

All item types have an ItemType_{SystemName} table associated where {SystemName} = name of item type. Each column represents a field and each row an instance.

Field name Data type Length
Id nvarchar 255
ItemInstanceType nvarchar 255
Description nvarchar Max
Sort bigint 8
TableName nvarchar Max

ItemTypeId

System table for keeping track of id numbering for item types

Field name Data type Length
ItemType nvarchar 255
Current int 4
Seed int 4
ItemTypeIdAutoId int 4

ItemTypeDefinitions

Contains item type definitions on solutions where they are stored in the database rather than as XML-files.

Field name Data type Length
ItemTypeDefinitionsSystemName nvarchar 255
ItemTypeDefinitionsMetadata nvarchar Max
ItemTypeDefinitionsModified datetime 8
ItemTypeDefinitionAutoId int 4