Creating page types

In this example, you will learn how to define a new custom page type.

  1. Open the Page types application.
  2. Click New page type. A New page type wizard opens.

Step 1

  1. Fill in the following values:
    • Page type display nameComputer (the system displays this name to users in the administration interface)

    • Namespacecustom (namespace to distinguish your page types from the default system types that use the cms namespace)

    • Name:computer (the identifier of the page type)

      Filling the page type display name

  2. Click Next.

Step 2

  1. Enter a Table name for the database table that stores the page type data.

  2. Enter a Primary key name for the table.

  3. (Optional) Select if you want the page to to Inherit fields from page type.

    Specifying the page table name

  4. Click Next.

The wizard creates the database table.

Step 3

Now, you need to define fields of the page type (columns of the table).

  1. Click New field.
  2. For each field, enter the values, click Save and repeat the procedure until you have defined all the listed fields.
  • Field 1:
    • Field name: ComputerName
    • Field type: Text
    • Field size: 200
    • Required: yes (checked)
    • Field caption: Computer name
    • Form control: Text box
  • Field 2:
    • Field name: ComputerProcessorType

    • Field type: Text

    • Field size: 200

    • Field caption: Processor type

    • Form control: Drop-down list

    • Editing control settings -> Data source: select List of options and enter the following items into the text area, one per line:

        Pentium XEON;Pentium XEON
        Pentium Core 2 Duo;Pentium Core 2 Duo
  • Field 3:
    • Field name: ComputerRamSize
    • Field type: Integer number
    • Field caption: RAM (MB)
    • Form control: Text box
  • Field 4:
    • Field name: ComputerHDDSize
    • Field type: Integer number
    • Field caption: HDD (GB)
    • Form control: Text box
  • Field 5:
    • Field name: ComputerImage

    • Field type: File

    • Field caption: Image

    • Form control: Upload file

      Creating fields for the page type

  1. Click Next.

You can also define system fields that will be displayed when editing pages of this type on the Form tab. You can do this using the Field type drop-down list when creating a new field. Select Page field and you can then choose from the following two groups of system fields:

  • Page fields - offers system fields of pages
  • Node fields - offers system fields of content tree nodes.

Page or node system fields will then be offered in the Field name drop-down list. If you leave the Display field in the editing form check-box turned on, the field will be visible on the page’s Form tab.

Step 4

Now you need to choose the field that will be used as the name for page’s of this type.

  1. Choose the ComputerName option from the drop-down list.
    This ensures that computer pages will use the value of the ComputerName field as the name displayed in site navigation and in the Page application’s content tree. The field is available in the drop-down list because you set it as Required in the previous step and it’s a text field.

    Specifying page name source

  2. Click Next.

Step 5

Select the page types that will be supported as parents for computer pages in the Page application’s content tree.

  1. If necessary, click Add page types and select the Page (menu item) page type.

  2. Click OK.
    Users are now only allowed to place computer pages under pages of the Page (menu item), not under articles, news items or other page types.

    Adding parent page types

  3. Click Next.

Step 6

Assign the page type to all websites on which you want to use it.

  1. Click Add sites.

  2. Check the appropriate websites in the selection dialog.

  3. Click OK.

    Adding sites where the page type can be used

  4. Click Next.

Step 7

The wizard has finished the configuration of the new page type. It has automatically created not only the database table, but also the SQL queries for SELECT, INSERT, UPDATE and DELETE operations and the default transformations. 

Click Finish. You have created a new page type. 

Now, you may want to:

How the content is stored

The new page type Computer has its own database table for its specific fields. Each page is stored in three tables: CMS_TREE (tree structure), CMS_Document (page properties, metadata and content defined on the Page tab) and the custom table - in the case of this example, CUSTOM_Computer.

The system automatically ensures all operations are performed correctly on these tables. The advantage of this storage is that it is very fast and you can easily write standard SQL SELECT queries to retrieve data from the Microsoft SQL Server database.