function answers_get_answers in Answers 5.2
1 call to answers_get_answers()
File
- ./
answers.module, line 467 - Enables the creation of question nodes that can be answered by posting answer nodes.
Code
function answers_get_answers($node, $teaser = TRUE, $page = FALSE) {
$answers = array();
$tresult = db_query('SELECT * FROM {answers} WHERE qid = %d ORDER BY nid DESC ', $node->nid);
$count = 0;
while ($answernode = db_fetch_object($tresult)) {
$odd_or_even = $count & 1;
$ansnode = node_load($answernode->nid);
if ($teaser) {
$rendered = module_invoke($ansnode->type, 'answers', 'embedded', $ansnode->nid);
if (is_array($rendered)) {
$rendered = implode(' ', $rendered);
}
$answers[$ansnode->type][] = theme('answers_answer', $node, $rendered, '0');
}
else {
$ansnode = node_load($answernode->nid);
$rendered = node_view($ansnode, $teaser, FALSE, TRUE);
$answers[$ansnode->type][] = theme('answers_answer', $node, $rendered, $odd_or_even);
}
$count++;
}
return $answers;
}