CodeKit Requirements and FAQQ. What are the requirements to run CodeKit?CodeKit should run anywhere that PHP or Perl run, on Unix, Linux or Windows.CodeKit will run on any database management system with an SQL interface. A sample MySQL schema is provided. If you use CodeKit with another database send me your schema and I will add it to the next release. The Perl version needs the DBI.pm package. You can use any CGI library such as CGI.pm. The PHP version will work out of the box using the PEAR, ADODB or phplib database libraries. Porting to a new database library is trivial. Let me know if you need another one. CodeKit is licensed as free software which means that you can use it for any project. If you do, send me a note saying how it went! Q. What is a universal code table?The usual approach to database codes is to create one database table for each code set. For each table you need the code itself, the name or description, the display order, and a deprecated flag which allows you to turn off data entry for obselete codes:create table country ( country_cd varchar(2), country_name varchar(64), display_order smallint(3), deprecated smallint(1), primary key (country_cd) ); create table month ( month_id smallint(2), month_name varchar(16), display_order smallint(2), deprecated smallint(1), primary key (month_id) ); ...And so forth. Eighteen code tables later you have twenty code add / update / delete code administration interfaces to write and twenty variations of select_country_dropdown(), select_month_dropdown() HTML user selection interfaces to program. Lots of code, lots of bugs, lots of wasted time. A universal code table (my term, I have never seen this anywhere else) is where you create a single database table that can hold any number of virtual code tables like this: create table ck_code ( code_set varchar(16), code_code varchar(32), code_desc varchar(255), code_order smallint(6), code_flag smallint(1), primary key (code_set, code_code) );Notice the 'code_set' field. This holds the code set name that each record belongs to, such as 'country', 'currency', 'month', etc. So this single table can very efficiently hold any number of code sets: code_set code_code code_desc ======== ========= ============= country fr France country jp Japan ... currency esp Spanish Pesetas currency usd United States Dollars ... month 1 January month 2 February ...CodeKit provides a single generic code add / update / delete administration interface and the CodeKit API generates any kind of HTML select element that one could wish for. This takes all of the programming work away from the code administation and code HTML interface part of a database project. Will CodeKit work with a templating system?The CodeKit.php class file will generate very nice user HTML select elements. You should be able to call $codekit->select(...) from within the templating system. It returns the select element as a string which you can print or insert into the page:
$str = $codekit->select('offered_courses');
print $str;
Even if you do not use CodeKit to generate HTML, it
is still useful as the interface to enter and maintain
all of your database the codes and their descriptions.
|