Thread: [pLog-CVS] plog wizard.php,1.39,1.40
Brought to you by:
jondaley
From: Oscar R. <phu...@us...> - 2004-04-21 18:45:19
|
Update of /cvsroot/plog/plog In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17379 Modified Files: wizard.php Log Message: Added support for custom fields -- Custom fields can be used to add fields for certain functions that we would like to have in each post. For example, we can add a custom field called "I'm feeling" (ála Livejournal) and plog will automatically display a textbox in the "New Post" page so that we can assign a value to that field. The value of the field will be stored in the database, with a reference to the article. The we only need to make certain modifications to the templates to make them show the values of those fields, using very simple methods such as $post->getField("my_field") $post->getFieldDescription("my_field") And so on. At the moment it works but the following items are still lacking: - support for removing fields - support for editing fields (name, description, etc) - fields can only be used when adding a new post. If the "preview" functionality is used, the value of the field will be lost and it will have to retyped again. - When editing the field, is not possible to get the value of the fields. - It is not integrated with the search feature. All these shortcomings will be fixed as soon as I have the time :) There are two new talbes in the database: one to hold the definition of each field (name, description, type), and another one to hold the values given to those fields for each article. In order to get it working, please rerun the wizard script so that the new tables are initialized. Also, have a look at the templates/blueish/post.template for an example of how to show the values of the fields. Index: wizard.php =================================================================== RCS file: /cvsroot/plog/plog/wizard.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** wizard.php 17 Apr 2004 21:33:50 -0000 1.39 --- wizard.php 21 Apr 2004 18:44:28 -0000 1.40 *************** *** 300,303 **** --- 300,326 ---- category_id int(10) NOT NULL default 0 ) TYPE=MyISAM;"; + + $Tables[22]["desc"] = "Definition of custom fields"; + $Tables[22]["code"] = "CREATE TABLE {dbprefix}custom_fields_definition ( + id int(10) NOT NULL auto_increment, + field_name varchar(255) NOT NULL default '', + field_description text NOT NULL, + field_type int(2) NOT NULL default '1', + blog_id int(10) NOT NULL default '0', + PRIMARY KEY (id,field_name) + ) TYPE=MyISAM;"; + + $Tables[23]["desc"] = "Custom fields that have been assigned to articles"; + $Tables[23]["code"] = "CREATE TABLE {dbprefix}custom_fields_values ( + id int(10) NOT NULL auto_increment, + field_id int(10) NOT NULL default '0', + field_value text NOT NULL, + normalized_value text NOT NULL, + blog_id int(10) default NULL, + article_id int(10) default NULL, + PRIMARY KEY (id), + FULLTEXT KEY normalized_value (normalized_value), + ) TYPE=MyISAM;"; + // --- |