Drop Shadow

Special Field Types

The plug-in tries to automatically format displays according to the kind of data stored there. However, some fields contain unrecognizable data, such as a Unix timestamp, html, or e-mail addresses.

E-mail address

If you have an e-mail address column, you can tell the plug-in that this is an e-mail address, and it will handle linking automatically. It will link to the e-mail address when the browser is “safe” (the user is logged in or is at an on-campus address); it will moderately obscure the address when the browser can’t be determined as “safe”.

<? $db->setFieldType('mail', 'email'); ?>

Please note that any e-mail obfuscation is easy for spammers to defeat if they wish to do so. If you don’t want an e-mail address harvested, don’t display it back without requiring a login.

URL

If you have a URL column, you can tell the plug-in that that’s what it is, and it will handle linking automatically. It will link to the URL when the browser is “safe”. Otherwise (to make your forms less useful for comment spammers) it will not link.

<? $db->setFieldType('website', 'url'); ?>

HTML fields

If you have a TEXT column that you want to accept HTML in, you can tell the system that this is an HTML field, and it will display a rich text editor in that field.

<? $db->setFieldType('website', 'html'); ?>

You’ll also need to call “$db->HTMLHead()” somewhere in your web page’s <HEAD> area. You’ll need to set the field type before you call HTMLHead().

By default you’ll get a simple HTML editor. If you want a more advanced one, use:

<? $db->setHTMLEditor('advanced'); ?>

If you want the simple HTML editor but with the option of editing the HTML code directly, use:

<? $db->setHTMLEditor('simple-html'); ?>

Unix timestamp

If you have a Unix timestamp, you can tell the plugin this and it will automatically format correctly:

<? $db->setFieldType('timequeued', 'unixtime'); ?>

Pre-formatted text

Sometimes your data will contain text fields of preformatted, monospaced text. Use the type 'preformatted' for these fields:

<? $db->setFieldType('legacy-lines', 'preformatted'); ?>

Non-counting numbers

Normally, numbers are converted to include commas at the thousands markers to make them easier to read. If your numbers don’t reflect an amount, however, this isn’t what you want. Use the type ‘raw’ for these numbers:

<? $db->setFieldType('id_number', 'raw'); ?>

Images and attachments

If you need to upload images or attachments, you can do so by making a varchar field in your database and making the text field store the URL to the image or attachment.

In MySQL, make the varchar field be 60 characters long.

In PHP, Set the field type to “upload” for that field, and for an optional third option set whether they can upload only images or only documents (by default they can upload anything).

<? //let them upload a head shot $db->setFieldType('headshot', 'upload', 'images'); ?>

The options are “images”, “documents”, and “all”. If you leave out the third option, “all” is the default.

As long as you’re on a page where you’ve set the field type to “upload”, the item should display correctly, either as an image, or, if it’s a non-displayable filetype, a link to the file. If you want to display it directly, you can use $db->formatUpload('value', 'field name', 'title') to get the display code. The 'title' parameter is optional, and in any case will only display if a link is required to the file.

Uploaded items will be available for viewing within ten minutes.