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 templateSingle 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. Click on the database activity you have set up

  2. In the next screen, click on the Templates tab. You will see the template options. Select the tab you want to create a template (Add template, Single template, List template)
    Templates tab

 


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 and/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 the 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 and click on the B prompt in the HTML toolbar
    Bold field names

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

  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 pixels (cellpadding="5"), and text will be aligned left (you could also align "center" (note American spelling) or "right"
    Add HTML code

  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
    Provide 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
     


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 (under 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)

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
    Select row in table

  3. Click on the Table icon in the HTML toolbar and select Insert row after or Insert row before (or column)
    Insert row

  4. To add the user tag, place your cursor where you want it to go in the template box, 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

  5. Scroll down and click Save template

  6. 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)



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

  2. Follow steps 2-6 above (under 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

  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)

» How-to glossary