Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Database templates.
Templates for the Database module allow you to control the visual layout of information when listing, viewing or editing database entries. It is a similar to the technique used to mail merge letters in word proccessors such as Microsoft Word.
The content of each field you create for your database and a few special tags (listed below) can be inserted into the output template by the use of tags. To use the tags found on the left side, use the HTML viewer, place your cursor in the text area of your target edit and then click on the tag you want to place. Or simply type the appropriate name within the required symbols like ##this## or [[this]].
- ##Edit## creates a clickable icon link that allows you to edit the current entry (only appears if you have the rights to do this)
- ##More## creates a link to the single view, which may contain more detailed info
- ##MoreURL## creates just the URL for the above link, useful for creating your own links
- ##Delete## creates a link that lets you delete the current entry (only appears if you have the rights to do this)
- ##Approve## create a link that lets you approve the current database entry (only appears if you have the rights to do this)
- ##Comments## creates a link to the view/edit comments page, the link text is the current number of comments (only appears if comments are turned on)
- ##User## creates a link to the user page of the user who submitted the entry, link text is their name
Here's a video demonstrating tag usage: http://video.google.com/videoplay?docid=7026851446099005477
This template allows you to control the fields used and their layout when viewing multiple entries at once (e.g. search results). It is possible that this view may simply provide an overview with more detailed information available by clicking on an entry to access the single view of the entry.
This is used to display a single entry at a time and so has more space for display and can use, for example, larger versions of images or optionally provide more information than shown in the list view.
This template creates the interface form used when adding or editing database entries
Lets you control the content of the RSS feed for database entries.
When you first create a database the templates will be pre-filled with appropriate HTML. If you later add fields then you can press the reset templates button and it will add HTML for the new fields in a similar fashion. If you have edited any of the templates in the meantime then your changes will be lost. It is recommended that you finalize the database fields before changing the template code.
At this time, there appears to be no way to save more than one template in the database module except for copying and pasting the html into a separate location.