Fortune

Component ID

645378

Component name

Fortune

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

1311

Component created

Component changed

Component body

BSD Fortune has arrived for Drupal!

The Fortune module is a port of the venerable BSD Unix fortune cookie program created by Ken Arnold. It provides a block that displays a random fortune each time the page is reloaded.

Fortune is similar to Quotes, but was built to specifically support the huge library of "fortune cookie files" which often rely on an 80 column display, a monospaced font, and tabs set 8 spaces apart.

Fortune Cookie Files

A "fortune cookie file" itself is a simple ASCII (ISO-Latin-1) Unix text file in which each fortune is followed by a percent symbol (%) on a line by itself. Fortune files usually come with a binary index file having the same name plus a ".dat" extension.

There are lots of places on the web to get fortunes. Most fortune files are GPL or public domain and free for distribution. Some links to sources of fortune files are included on the module's settings page.

Adding Fortune Files

The Fortune module uses the "fortunes" folder in the files directory as storage for both fortune and index files. You can add new fortunes to that folder via FTP or by using the Upload field on the Fortune Settings Page (admin/settings/fortune). When using FTP you should include the .dat file, but in the Settings form you only have to upload the fortune file itself, and a .dat file will be created automatically.

Comparison to Quotes

When I started writing this module I didn't realize there was a "Quotes" module already! Nothing turned up when I searched for a "Fortune" module, and there wasn't anything yet built to the BSD fortune file spec. The Quotes module could add BSD fortune file support anytime. Meanwhile I hope this module makes using those fortune files simpler.

Planned Features

- Import fortunes into the database instead of (or in a addition to) keeping them as files. The version 1.0 was released without database support as a faithful implementation of the file-based fortune reader.
- Reload via AJAX after a timeout or in response to user interaction.