back to main page

Hacking BaseBlog source code

General overview

I am very proud of BaseBlog's source code. My idea behind open source projects is that the code (as it is written once but it is read thousand of times) has to be the most clear as possible. There are no classes or templates: both of them are not suitable for a small project like BaseBlog.


General structure

Constants with a global scope are defined in config.inc.php. Global functions are declared in some files in the include folder. Pages are written joining more logical "blocks" (typically rappresented as html divs): theese blocks are located one per file, in the blocks folder. All the administrator pages are collected in the admin folder.


Multiple database support

A full database support consist in three specific files: db_dbtype.inc.php, blogdb_dbtype.inc.php, adminblogdb_dbtype.inc.php. The first defines the basilar database operations (open/close/query and some more), the second file defines the sql queries for getting the data (i.e. getArticles, getCategories), the third file defines the sql queries for the admin functions (i.e. insert, update).

Theese files are included by the db.inc.php, blogdb.inc.php and adminblogdb.inc.php respectively, with a simple text-replacement of the "DBTYPE" define of config.inc.php.


Valid XHTML 1.0 Strict