Calling all Drupal developers!
Help us get this on the first page of Digg. DIGG NOW!
Help us get this on the first page of Digg. DIGG NOW!
faq_get_faq_list()
contributions/faq/faq.module, line 1955
Format the output for the faq_site_map() function.
Return a list of FAQ categories if categorization is enabled, otherwise return a list of faq nodes.
<?php
function faq_get_faq_list() {
// Return list of vocab terms if categories are configured.
$use_categories = variable_get('faq_use_categories', FALSE);
if ($use_categories) {
return faq_get_terms();
}
// Otherwise return list of weighted FAQ nodes.
$default_sorting = variable_get('faq_default_sorting', 'DESC');
$default_weight = 0;
if ($default_sorting != 'DESC') {
$default_weight = 1000000;
}
$items = array();
$result = db_query(db_rewrite_sql("SELECT n.nid, if((w.weight IS NULL), %d, w.weight) as weight, n.sticky, n.created FROM {node} n LEFT JOIN {faq_weights} w ON w.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND (w.tid = 0 OR w.tid IS NULL) ORDER BY weight, n.sticky DESC, n.created %s", "n", "nid"), $default_weight, $default_sorting);
while ($row = db_fetch_object($result)) {
$node = node_load($row->nid);
if (node_access("view", $node)) {
$items[] = l($node->question, "node/$node->nid");
}
}
return theme('item_list', $items);
}
?>