function keywords($args) { $method = $_SERVER['REQUEST_METHOD']; switch ($method) { case 'GET': $keywordsDao = new KeywordDAO(); $keywords =& $keywordsDao->getKeywords(); // There are two obvious formats for this data: // * an HTML ul // * an HTML select // I think a ul would be a bit better, but in practice a select // is very handy. I may change it someday, however. header('Content-type: text/plain'); for ($i = 0; $i < count($keywords); ++$i) { $keyword = $keywords[$i]; if ($i > 0) { echo "\n"; } echo $keyword->getName() . ':' . $keyword->getDescription(); } break; } }