Creating Custom Item Types

When you're organizing a resources page or information portal, the database item types (such as articles, blog posts, web sites, blogs, events, books, ...) that you're likely to need are part of Webvanta's Knowledgebase system. But for a full-featured site, often you need to create a database structure that is specific to your unique application.

In the past, to set up a custom database system required a programmer -- and thousands of dollars worth of programming time -- to implement. With Webvanta, you can create custom database types in a matter of minutes, without any programming skills.

For example, suppose you're building a web site about pets, and you want a directory of breeds (as in our Step-by-Step Tutorials section). You need a database for managing a list of breeds, with a photo for each, and various specialized fields like color, coat, care, etc. Or perhaps you're building a site about wine, so you need a wine database, with fields for varietal, vintage, etc. Or you're creating a site for an artist, so you need a database of art pieces. Or a hotel with various package deals and specials. The list goes on and on, and each one is unique in its needs.

Creating a Custom Item Type

If you want to define the fields that will be stored for each item, you need to create a custom item type. (Choose Database > Item Types and then click Add New Custom Item Type.)

Unlike many other content management systems, in which it is either impossible to set up custom database structures or requires a programmer to do so, Webvanta makes it simple.

From Information Architecture to Database Structure

There's one key task that Webvanta can't automate for you, however: designing a database structure to represent your information domain. This requires thinking through the categories (taxonomy) that defines all the site's topics (like dogs, cats, birds, fish, ...), and the item types you need to store different things (like articles, links to other sites, book listings, or breeds).

Start by mapping out all the categories and item types that your site needs. Often, Webvanta's standard item types meet most of your needs, and one or two custom times are all you need.

For each custom item type, create a variety of example entries, and think through all the information fields you'll need. You can add fields at any time, but it's nevertheless best to start out with a solid foundation.

For the rest of this article, we're discussing the creation of one custom item type.

Setting Up Fields

Webvanta provides a number of standard fields for every item in the database, which you can use to the degree that it fits your needs. Some fields, such as publication date, have special effects: this field, for example, can be set in the future to control when an item becomes visible on the public site. You can change the label of any of the standard fields to make it fit your application.

You can also create custom fields, for which you provide both a name (used for referring to the value in code) and a label (shown on forms). You specify for each field whether it is a simple text field, a text area, or something else (like a checkbox), as well as the width and (for text areas) height.

For many of the field types other than text field or text area, you must enter additional information in the Type Options field. The following table lists the field types, their uses, and the Type Options.

Field TypeUsageType Options
Text Field The most common field type. Can hold text of any length, with a single-line input area. None
Text Area For larger text fields, a text area has multiple lines in the input field. None
WYSIWYG Text Area A Text Area that uses the built-in WYSIWYG editor for editing the text. None
Code Text Area A Text Area that uses the built-in code editor for editing the text. None
Taxonomy Presents a pop-up list of items, which are drawn from the specified taxonomy (list of options). Taxonomy name, which must exist before creating the custom item type that references it. Add asterisk (*) after name to enable multiple select. You can override the default number of items displayed by the menu at a time (selector height) by entering the number in the Height field.
Check Box Displays a simple check box, for items that are yes/no, true/false. Enter 1 to set default value to checked. Otherwise leave blank.
Field Set Use for repeating groups of fields. The set of fields that repeats is defined by another custom item type (which must exist before creating the custom item type that references it). Use the name of the other custom item as the field name for this item. Number of times the field set is repeated. If blank or 0, form will display one field set with an "add another" button, and user can add any number of field sets. If a number is entered here, then only that number of field sets is displayed.
Related Items Use to connect to one or more other DB items of a particular type. For example, you may have a products database and a companies database, and link to the company from the product item type. Displays selector list with all the items of the specified type(s). Name of item type to which relationship is created. Can be a comma-delimited list of multiple types.
Related Assets Choose assets (typically images, could also be documents or videos) to associate with this item. Displays selector list with all the assets specified in Type Options. A single tag, or a comma-delimited list of tags (or blank); only assets that match at least one of the tags will be shown in the selector list. Add an asterisk (*) at the end of the list to enable multiple select.

Field Sets

In more complex situations, you may have a set of fields that you want to repeat as a group. For example, suppose you're building a product review site. As part of the "product" item type, you may want to have a number of features, with each feature having a description, notes, and a rating. You can do this by defining a field set that includes these three fields, and then adding as many as needed of that field set to the item. The automatically-generated form starts out with one field set, with an "add another" button, so the content editor can add as many features as they need for a particular product.

Accessing Custom Items with WebvantaScript

Accessing your custom items is generally the same as accessing standard items, as described in Accessing Database Information with WebvantaScript.