public static function getTagCategoriesByScheme($db, $app_root, $scheme) { $cats = new Dase_Atom_Categories(); $cats->setScheme('http://daseproject.org/category/' . $scheme); $prefix = $db->table_prefix; $sql = "\n\t\t\tSELECT term, label \n\t\t\tFROM {$prefix}tag_category \n\t\t\tWHERE scheme = ?\n\t\t\tGROUP BY term, label\n\t\t\tORDER BY label\n\t\t\t"; $dbh = $db->getDbh(); $sth = $dbh->prepare($sql); $sth->execute(array($scheme)); foreach ($sth->fetchAll() as $row) { $cats->addCategory($row['term'], '', $row['label']); } return $cats->asXml(); }