Jump to content

Databases part II

Database URL Structure

Databases exist inside a page you've created with Pages. Individual categories and records in the database are accessed via the URL of the page. For example, if you had a page with the URL <yourcommunity>/mypage and this page contained your database, you might have a record that's accessed via the URL <yourcommunity>/mypage/category/record, where category is the category name and record is the record name. Your URLs would dynamically update themselves if you renamed your page or moved the database to a different page.

To facilitate this approach, databases can only exist in one page at a time. They can't be duplicated on other pages (although you can create blocks showing data from the database and use them on other pages).



More advanced uses of databases require custom data to achieve their goals, and fields can be set up to gather this data. Fields are created in the AdminCP, and when a user adds a new record, the fields are shown on the form. 

IPS4 supports a wide range of field types, allowing you to capture data of a specific type easily. Here's the supported types:

  • Address
    Provides a special auto-completing address field, powered by Google
  • Checkbox
    A single on/off checkbox
  • Checkbox set
    A group of several on/off checkboxes
  • Code
    Provides a way to syntax-highlight code
  • Date
    A date field, with a date picker
  • Editor
    Provides a rich text editor for WYSIWYG editing
  • Database relationship
    An advanced field type that allows records from different databases to be associated
  • Member
    Provides an auto-complete member search box
  • Number
    A number input box (on older browsers, reverts to a simple text box but with number validation)
  • Password
    A password input field
  • Radio
    A group of radio boxes (meaning only one of the options can be selected)
  • Select box
    A drop-down menu containing the provided options (can allow multiple selections if desired)
  • Soundcloud
    A Soundcloud embed field
  • Spotify
    A Spotify embed field
  • Telephone
    A telephone number input field (on older browsers, reverts to a simple text box)
  • Text (default)
    A one-line text input field
  • Text Area
    A multiple-line text input field
  • Upload
    An IPS4 upload field
  • URL
    A URL input field (on older browsers, reverts to a simple text box with URL format validation)
  • Yes/No
    A toggle field that can accept yes or no values
  • YouTube
    A YouTube embed field

Many of these field types have additional options specific to them. For example, select boxes have an option to allow multiple values to be selected, whereas the upload has options to allow multiple files, and a way to restrict file types.

Field Formatting

Fields can have automatic formatting applied to them. For non-coders, a range of badge colors is available to choose from, and you have some control over the location that the field shows in the listing or record display. For coders, however, you have full control over the HTML output for each field, including having use of IPS4's template logic. This means you have the ability to use the data stored by IPS4 for each field in some very interesting ways - for example, you might take the value of an address field and use it to output an embedded Google Maps map, or even create some fields that you don't output, but instead use to control the layout of your record templates. There are a huge number of possibilities.



There's multiple levels of permissions at play with databases:

  • Page-level
    Since pages have their own permission settings, if the user doesn't have permission to see the page, they won't be able to see the database either.
  • Database-level
    Permissions can be set at a database-level, which forms the default permissions for categories in the database too.
  • Category-level
    A category can optionally override the database-level permissions and provide its own. This is useful for hidden categories - perhaps staff only, or a category only for premium members.


Managing Databases

Databases are managed by going to Pages -> Databases in the AdminCP. You'll also find that databases are listed in the Pages menu in the AdminCP for quicker access. From this screen, you'll see some simple information about each of your databases, as well as menu items to manage each part:


Managing Database

Records can be added either via the AdminCP (click the   icon) or via the front-end page that displays the database. This means users don't need AdminCP access to add/edit records.


Creating Databases

To create a database, click the Create New button on the screen above. There's a number of configuration options available to you.

  • Details
    The basic settings for this database. At the bottom of this tab, you can choose the templates you want to use for this database. If you haven't created them yet, you always do this later.
  • Language
    On the Language tab, you set up the words that will be used to refer to records in this database (rather than the generic 'records' terminology). For example, if you are creating a database for guides, these language choices will mean IPS4 will refer to your database in context, such as "Search Guides", "There are 5 guides in this database" and "Create a new guide".
  • Options
    This tab more finely controls how your database will work, including comments, reviews, tagging, and the 'wiki-style' editing we covered earlier. Sorting options are also available here, allowing you to choose the order of records, and more importantly, the field on which they are sorted. For example, if you had a database containing records about dinosaurs, you may want to sort the records by Era (a custom field you will have created). You can return to this tag after creating your fields later to configure it.
  • Forum
    This tab configures the aforementioned Forums integration for the database (individual categories can override these settings too).
  • Page
    Since a database requires a page in which it displays, you can easily create one here as part of the database creation process. Alternatively, you can add it to one of your existing pages later.


Adding to a Page

If you don't create a page as part of the database creation process (above), you can do so manually by using a special database tag in your page content. On the Details tab of the database form, you specified a database key. This is how this database is included in pages. If the key is my-database, you'd insert it into a page by placing this:


As mentioned above, a database can only exist on one page at a time; trying to use this tag on multiple pages won't work correctly.

  Report Guide

  • Create New...