getDatabaseHandler(); $category_list = $dbhandler->getCategoryIDs(); $i=0; while (isset($category_list[$i])){ // For each category id create the coresponding Category object $categories[]=new Category($category_list[$i]); $i++; } return $categories; } /** * The database is accessed through a database handler. The default * database handler is returned by this function. * (The default depends on project preferences) **/ function getDatabaseHandler(){ // STUB: The default at the moment is the MySQLDatabaseHandler as it // is the only handler. Theoretically this should be read from a // config file instead of being hardcoded. // Singleton pattern. Only one database handler instance needs to exist if (!$this->databaseHandler) { require_once("../inc/forum_dbh.inc"); require_once("../inc//forum_mysql_dbh.inc"); $this->databaseHandler = new MySQLDatabaseHandler(); } return $this->databaseHandler; } } // This object is globally accessible as $mainFactory $mainFactory = new MainFactory(); ?>