Installing and Configuring Dornbase

Dornbase is a PHP contact management system I started a while ago and recently released via Sourceforge (http://sourceforge.net/projects/dornbase/). You can see a demo of it running at http://jeremydorn.com/dornbase.php.

The project is still in its early stages, so there is not much documentation available. I plan to eventually implement an automated installer, like Joomla and most other major PHP applications have. If you have any suggestions or want to help, email me at jeremy@jeremydorn.com.

This post is meant to serve as a guide for installing and configuring Dornbase on either your local machine or a remote host.

Minimum Requirements

Most paid web hosts meet these requirements. All of the required software is included in xampp (http://sourceforge.net/projects/xampp/).

  • Apache 2.2 with mod_rewrite enabled
  • PHP 5+ (make sure ERROR_REPORTING is set to not show E_NOTICE)
  • MySQL 5+ (I haven't tested older versions, but they probably work too)

Download Files

Download Dornbase 1.7 from http://sourceforge.net/projects/dornbase/ and extract the files to your document root (C:/xampp/htdocs/ if using xampp).

Set up Database

Create a new database and run all of the queries in the db_setup.sql file included in the download to set up the database tables. If you are using xampp, follow the phpmyadmin instructions below to do this.

PhpMyAdmin Instructions
  1. Go to http://localhost/phpmyadmin.
  2. In the "Create new database" form, enter a name for the database (e.g. "dornbase") and click the "Create" button.
  3. Click the "import" tab.
  4. Select the db_setup.sql file and click "Go".

The only table you may want to change is the "fields" table, which contains all the fields a record will have. By default, it is set up with all of the fields in the demo, but this can be easily changed. Below is a brief description of what each column in the fields table means.

name- The id of the field (no spaces, all lowercase) (e.g. fname, address_line_1) display- The display name of the field (all lowercase) (e.g. "first name", "address line 1")
datatype- The datatype of the field. Either 'text', 'number', 'date', or 'boolean'.
type- A more specific type differentiator (e.g. 'phone', 'website', 'money', 'ssn')
multiple- Can the field have multiple values? '1' for yes, '0' for no
discrete- Are the field values limited and discrete (i.e. will it use a drop down menu)? '1' for yes, '0' for no
search- Should this field be searchable? '1' for yes, '0' for no
default- The default value this field will have for a new record
summary- Is this field vital for uniquely identifying a record?
padto- For numeric fields, the max number of digits (e.g. if '12', all values are left padded with 0s until there are 12 characters left of the decimal point). This enables storing numbers as text and still being able to properly sort them.

Configure Server

Rename the "server_default" folder to "server". This folder contains 2 files which you need to edit. There are comments and instructions in each of the files.

Rename "htaccess-default" to ".htaccess" (You may need to open it in notepad and use Save As on some Windows machines). Edit the line "RewriteBase /dornbase" and change "/dornbase" to whatever directory you installed the application in.

Rename the "config_default" folder to "config". This folder contains several files that help you customize Dornbase to fit your needs. I'll explain each of these files later.

Test it out

Open up Dornbase in a browser (if you installed it in /htdocs/dornbase/, go to http://localhost/dornbase/). You should see a sign in page. Sign in with the default admin account (username: "admin", password: "password"). If you see an empty record page, everything is installed correctly.

You may see errors if you modified the record fields in the database. After the next step, this should be fixed.

Customize

The important files to edit in the config folder are template.php, record.php, and functions.php.

template.php is really short and defines a few variables such as business name and return address (for printing envelopes).

record.php only needs to be changed if you modified the record fields in the database at all.

functions.php is a large file and contains a bunch of callback functions that provide hooks into the application. I'll go through a few of the important functions.

  • get_record_header(&$data) - Should return the header for a record. By default, it displays the full name (or company if name is empty) followed by a description and the policy type.
  • get_field_order(&$record, $mobile=false) - This determines the layout of the record. It allows you to layout the record differently depending on the record data. For example, you can have a "spouse name" field only show up if their status is set to "married". You can also display different fields on a mobile device.

You can play around with the other functions and the other files in the config folder if you want.

After you make a change to a file in the config folder, most of the time refreshing the page will work. In a few cases, you may have to sign out and sign back in for the changes to take effect.