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_child_categories_faqs($term, $theme_function, $default_weight, $default_sorting, $category_display, $class)
contributions/faq/faq.module, line 2178
Helper function for retrieving the sub-categories faqs.
$term The category / term to display FAQs for.
$theme_function Theme function to use to format the Q/A layout for sub-categories.
$default_weight Is 0 for $default_sorting = DESC; is 1000000 for $default_sorting = ASC.
$default_sorting If 'DESC', nodes are sorted by creation date descending; if 'ASC', nodes are sorted by creation date ascending.
$category_display The layout of categories which should be used.
$class CSS class which the HTML div will be using. A special class name is required in order to hide and questions / answers.
<?php
function faq_get_child_categories_faqs($term, $theme_function, $default_weight, $default_sorting, $category_display, $class) {
$output = array();
$list = taxonomy_get_children($term->tid);
foreach ($list as $tid => $child_term) {
$child_term->depth = $term->depth + 1;
if (taxonomy_term_count_nodes($child_term->tid, 'faq')) {
$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 INNER JOIN {term_node} tn ON (n.nid = tn.nid AND n.vid = tn.vid) LEFT JOIN {faq_weights} w ON w.tid = tn.tid AND n.nid = w.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY weight, n.sticky DESC, n.created %s", "n", "nid"), $default_weight, $child_term->tid, $default_sorting);
$data = array();
while ($row = db_fetch_object($result)) {
$node = node_load($row->nid);
if (node_access("view", $node)) {
$data[] = $node;
}
}
$output[] = theme($theme_function, $data, 1, $category_display, $child_term, $class);
}
}
return $output;
}
?>