Re: New HTML or Maintain DB class needed?

From: Date: Fri, 17 Jan 2003 16:48:39 +0000
Subject: Re: New HTML or Maintain DB class needed?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3332@lists.php.net to get a copy of this message
yes, cool you just spelled out the big idea, for which i implemented one little piece of the puzzle, which is the DB_QueryTool package. it lets you easily interface with the DB, without the need to write queries as such. the query can be built using object methods (kinda like DB_DataObject). and in combination with QuickForm it should not be too hard to get this done. whatever, basically there are the pieces for the puzzle in PEAR choose those that suit u best and i am curious to see the result :-) regards wolfram Stefan Fountain wrote:
For those of you willing to have a look at this I am wondering how and if creating this new class is useful so please give some feedback as to the architecture and use of such a class. Any feedback is welcome let me know if there are known classes that already address the issues my 'new' class will try to solve. Thanks for your help/feedback, Stefan Fountain
I've been looking at creating a new class with the main purpose of being the core section of a CMS that edits tables. I'm wondering if it is wise to extend an existing class or make a new one. There are a lot of DB classes already in the PEAR and one more might cause some confusion (if even it gets added to PEAR) I would like to discuss the possibility to add functionalities to existing PEAR classes or if necessary indeed create a new one. Maybe there already is a DB class (or another class) that holds the functions I want but could not find it in the PEAR browser. In a sense my class is a HTML interface to edit DB tables. An example of how such a class could look like : Description: Class that will get defined fields from a db table and return them in an HTML list with the possibilities to edit or delete. The list will show an add function as well. Edit will return a form with the specified record and validate upon submit (maybe using PEAR::Quick_Form?) Add will do the same but with blank fields. It would work similar to a script that uses a $cmd variable to switch between commands (list, edit, add, delete). The class would return HTML to the script that calls it, optionally this could be extended in the future to deliver XML feeds of database results or whatever. Class attributes: Db connection parameters array->(db_host, db_name, db_user, db_passw) Table parameters array->(table_name, array(table_fields, table_field_types), key_field) HTML Templates
    array->(list_template, edit/add template, delete_template)
(Also 'private' attributes like item_from_db_array etc.) Class methods: Constructor($cmd) // switches between wanted command List_items() // calls db and lists items in local array Add_new_item() // does as the name implies Edit_specific_item() // does as the name implies Delete_specific_item() // does as the name implies Obviously there will have to be get and set methods as well as a good way of setting up the interaction between different methods (for example edit being the same as add but with default values returned from db) That's the idea.
-- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... translating template engine .... http://sf.net/projects/simpletpl ... authentication system .... http://sf.net/projects/auth

« previous php.pear.general (#3332) next »