Skip to content

NoteOnMultipleConfigsAndWidgets

johnkawakami edited this page Sep 14, 2010 · 4 revisions

The ‘config’ table stores all the configuration options for an instance of a Crows site. It takes over for most of what config.php contains.

To keep the code organized, and to encourage the development of more widgets, I took the liberty of starting a “plug in” system. It’s in the /widgets folder.

Under /widgets, each widget has a folder, named for the widget.

Within each folder there’s a single file, *_db_setup.php, where * is the name of the folder. Within each file is a definition of a class named *_db_setup. Two methods can be defined: setup_table and setup_config.

setup_table runs a query to create a table. One of these tables is the config table.

setup_config runs queries to add configuration columns to the config table, as well as corresponding UI info for the administration tool into admin_fields.

The script admin/setup_db.php runs both methods for all the widgets. (Plus some housekeeping.) It uses the “hollywood principle”: don’t call us, we’ll call you.

The idea I’m trying to implement is a consistent interface for widgets, so that other programmers can create widgets, and crows admins can deploy these widgets without needing to enter any kind of text editor. (Ideally, these widgets would be ZIP files on some server, and the admin can download them and install them with one click.)

Clone this wiki locally