Fri Jul 09, 2004
Generic DB (gDB) Class for Textpattern
I started (and mostly finished) a txp plugin to integrate in some of Coppermine’s functionality. To make this possible, I chose the approach of going directly to the Coppermine database, but the database class within txp didn’t allow for deviation from txp. Like any other coder in my position, I wrote my own generic class to fill the current need and many future needs.
The gDB class includes all of the functions provided within ./textpattern/lib/txplib_db.php, except they are accessed as member functions and work against the class’ db connection. Go here if you have questions pertaining to this class.
Installation Steps:
- Download
- Place the file in the ./textpattern/lib/ folder of your installation.
- Remove the ”.txt” extension from the file.
- Add the line
include txpath.'/lib/txplib_db.php';to the top of ./textpattern/publish.php (below the other includes) or in your plugin source. - Done.
Example Usage:
$cpgDB =& new gDB('host','dbname','user','pass','table_prefix');
$rs = $cpgDB->safe_rows('*', 'textpattern', 'author="ThatGuy"');
...




