I’ve generated a query, as follows, and formatted the results as links:
$result = db_query("SELECT name FROM {taxonomy_term_data} WHERE vid = :val", array(':val' => '1'));
$list = array();
foreach ($result as $record) {
$list[] = l($record->name, 'blog/' . $record->name);
}
Now I would like to render this array as an unordered list and return it to a block. What’s the proper function/syntax for doing this?
Also, where is a good reference for functions related to rendering?
Thanks in advance for any help!
Note that “the proper way to render a query result” does not exist, there are many ways. They could be rendered as a list, as a table and many other ways. What you are asking for is the proper way to render a list of links, that these links are coming from the database is not relevant.
See http://api.drupal.org/api/drupal/includes–theme.inc/function/theme_links/7. And instead of calling theme() directly, you can also use the so called renderable arrays which are a new feature in Drupal 7 and the preferred way to do this now.