function glossary_search_results in Glossary 6
Same name and namespace in other branches
- 5.2 glossary.module \glossary_search_results()
- 5 glossary.module \glossary_search_results()
- 7 glossary.module \glossary_search_results()
1 string reference to 'glossary_search_results'
- glossary_menu in ./
glossary.module - Implementation of hook_menu().
File
- ./
glossary.module, line 334 - Glossary terms will be automatically marked with links to their descriptions.
Code
function glossary_search_results($keys = NULL) {
$vids = _glossary_get_filter_vids();
$output = '<div class="glossary-list">';
$sql = db_rewrite_sql("SELECT t.tid FROM {term_data} t WHERE t.vid IN (" . db_placeholders($vids) . ") AND (t.description LIKE '%%%s%%' OR t.name LIKE '%%%s%%')", 't}', 'tid');
$vars = $vids;
// Yes, we need this twice.
$vars[] = $keys;
$vars[] = $keys;
$result = db_query($sql, $vars);
$found = NULL;
while ($row = db_fetch_object($result)) {
++$count;
$term = taxonomy_get_term($row->tid);
$found .= '<dl>' . theme('glossary_overview_item', $term, TRUE) . '</dl>';
}
if (!$found) {
$found = drupal_get_form('glossary_search_form', $keys) . '<p>' . t('Your search yielded no results') . glossary_help('glossary_search#noresults') . '</p>';
}
$output .= theme('box', t('Glossary search results'), $found);
return $output . "</div>\n";
}