Database - customise the templates (step 3)

1. Plan  |  2. Build  |  3. Test  |  4. Administer  |  5. Review  ||  Support 

database iconThis entry relates to the Database activity.

Templates for the database activity allow you to control the visual layout of information when listing, viewing or editing database entries. A basic level of HTML knowledge may be necessary to edit database templates. If you need help, contact your local eLearning support team

Before you create a template, you first need to Create a database activity (step 1) and Build a database activity (step 2).

There are six template types, but the most important ones (for a good user experience) are the Add template, Single template and List template. You will need to make changes to all three templates. The instructions below are for basic customisations only. For more sophisticated customisations, contact your local eLearning support team

  1. View template options 
Then create your templates in the following (logical) order:
  1. Add template (how the Add entry looks)
  2. Single template (how a single entry looks)
  3. List template (how a list of entries looks)


View template options

These instructions tell you how to bold the field names, and make the table that field names and field types sit in more viewable and usable.

To view the complete list of templates, and access the View list, View single and Add entry types:

  1. In your topic, click the Turn editing on button

  2. Click on the database activity you have set up

  3. In the next screen, click on the Templates tab
    database tabs

  4. You will see the template options. Select the tab you want to create a template (Add template, Single template, List template)
    all templates


1. Create an Add template

The Add template determines what users see when they click on the Add entry prompt (ie how the fields are displayed). In this template, you can provide more information/instruction to users about what they need to enter into a field (eg instead of just having the field title, have a question &/or examples). Example field name: 'Duration' – the question  could be 'How long did this task take? (Please enter in hours, rounded to the nearest full hour.)'

These instructions tell you how to bold the field names, and make the table that field names and field types sit in more viewable and usable.

  1. As per the steps above (View template options), make sure you are in the Add template tab

  2. To bold field names, highlight the field name in the Repeated entry box, and click on the B prompt in the HTML toolbar
    bold row headings

  3. To make the table more user friendly by creating more space between field names (left-hand column) and responses (right-hand column), you will need to go into the HTML code. To do this, click on the HTML icon in the HTML editor 
    HTML code to edit

  4. You will now see the HTML code view for the template

  5. Add style="width:100%;" cellpadding="5" align="left" [+ space after "left"/before code that follows] after <table ...> (ie <table style="width:100%;" cellpadding="5" align="left" ). This code means the table will use all space available in the screen (width:100%), the distance between table cell and text will be 5 pixel (cellpadding="5"), and text will be aligned left (you could also align "center" (note American spelling) or "right"
    table code for more usability

  6. To provide instructions to the user adding an entry, put your cursor at the beginning of a right-hand row, and click Enter. Fill in the space above with the instruction
    add template instructions

  7. Scroll to the bottom of the screen and click Save template

  8. To see what your changes look like, click on the Add entry tab. The instructions will show above the HTML editor
    add entry tab 

    view Add entry instructions


2. Create a Single template

The Single template determines how one result looks to the user. This is the template where you can add a user tag so that you know who has contributed.

These instructions tell you how to bold the field names, and make the table that field names and field types sit in more viewable and usable.

  1. As per the steps above (View template options), make sure you are in the Single template tab (under Templates)

  2. Follow steps 2-6 above (Create an Add template)

  3. Scroll to the bottom of the screen and click Save template 

  4. To see what your changes look like, click on the View single tab (you need to have added an entry to see what this looks like)
    View single tab

Add a user tag

If you add a user tag, you will be able to see who has added an entry, which will be useful for adding comments etc. You can update the template with this tag even after the database is open for adding entries (and entries have been added).

These instructions assume you have already set up this template (see above).

  1. Under Templates, click on the Single template tab

  2. With your mouse, select the row in the Single template text box that you want to add a user row/column after/before
    Add row to template

  3. Click on the Table icon (which should now be highlighted as above) in the HTML toolbar and select ‘Insert row after’ or ‘Insert row before’ (or column)
    insert row

  4. In the new row/column, type whatever heading you want to show in the entry (this could be ‘Contributor’) with a colon after it (eg Contributor:

  5. To add ##user## in the other (in this example, right-hand) column (or row), place your cursor where you want it to go, then select User (under Other) in the Available tags box. The ##user## tag should automatically appear in the selected location in your template table
    add user tag

  6. Scroll down and click ‘Save template’

  7. To check, click on the View single tab (add an entry to see how this looks if the database is not yet open to students)
    example with user tag



3. Create a List template

The List template determines how a list of results (entries) looks to the user. You do not need to include every field (eg as for the Add template), particularly when there are lots of fields. The list can just be some key fields (eg Journal name).

  1. As per the steps above (View template options), make sure you are in the List template tab (this is the default under Templates)

  2. Follow steps 2-6 above (Create an Add template)

  3. To delete a field, select the table row, click on the Table icon in the HTML editor and select Delete row
    delete row in the list template

  4. Scroll to the bottom of the screen and click Save template

  5. To see what your changes look like, click on the View list tab (you need to have added at least one entry to see what this looks like)
    View list tab

» How-to glossary