Jump to content

Guides

Creating basic templates

About database templates

In Pages, there are four kinds of basic database template:

  • Listing
    The templates that show the list of records. If you use categories, this is the template used when you click into a category. if you don't use categories but do use a record listing, this is the template that forms the index/homepage of the database.
  • Form
    A template that allows you to customize the add/edit form for records in your database.
  • Display
    Templates used when displaying a record, including the comments & reviews portions.
  • Category Index
    If you use categories, these categories generate the category listing. This forms the index/homepage of the database, but also renders any sub-categories once you click through.

In addition, there's some other templates that are used when you use a database in its 'article' mode.

You can create new versions of the above templates and assign them to your database. Each database can use a different set of templates, so it's possible to have very unique areas of your site, each different from the others.

Templates are also extremely powerful. You have access to a large amount of data in them, and all of the usual IPS Community Suite template syntax is available including HTML logic, template tags and raw PHP (see the Template Syntax guide for more information). With some creativity, and knowledge of HTML and template syntax, you can create databases that don't at all feel like the usual 'list of records' approach.

 

Creating our database templates

Since we don't use categories in our Release Notes database, we don't need to create a set of those templates. Similarly, we aren't going to be concerned with the record form template; the default will be fine for our use. That leaves us with the Listing and Display templates, and we'll create new sets so we can customize them without impacting any other databases.

To create them, head over to Pages -> Templates. In the left-hand panel of the template editor, you can click to expand the existing database templates and get a feel for how they are structured. Click the New button in the editor, and then select New Database Template

For the name, we'll enter ReleaseNotes so that we can easily identify it later. Ensure that Record Listing is selected as the template type. Conveniently, this popup window allow allows us to assign the templates to a database right now, so choose the Release Notes database for this field.

Note: if you don't assign the template to the database here, you can always do so later by editing the database itself and selecting this template set under the Options tab.

Click Save to create the template set. Repeat this process to create a Record Display type. Note that the name should still be ReleaseNotes - by using the same name, all of the template bits for both template types will exist in one group, which (in my opinion) makes it a little easier to use. You can create a separate group for each type if you prefer, however.

 

Exploring the templates

If you now expand the Database Templates category in the editor, you'll see the two new sets we've created. If you expand those, you'll see a dozen or so template bits that make up the set. We won't be editing all of these in later steps; some won't be used in what we're doing, and others are fine as default. When later steps refer to editing a database template bit, this is where you'll go to do so.


  Report Guide


×