function theme_questions_top in Frequently Asked Questions 5
1 theme call to theme_questions_top()
- faq_page in ./
faq.module - Function to display the faq page
File
- ./
faq.module, line 808
Code
function theme_questions_top($result, $display_vars) {
// configure "back to top" link
$back_to_top = '';
if (!empty($display_vars['back_to_top'])) {
$back_to_top = '<p class="faq_top_link">';
$back_to_top .= l(t($display_vars['back_to_top']), 'faq', array(), NULL, '') . '</p>';
}
// loop through results
$questions = array();
while ($node = db_fetch_object($result)) {
$node_obj = node_load($node->nid);
if (node_access("view", $node_obj)) {
$anchor = "n" . $node->nid;
$questions[] = l($node->title, 'faq', NULL, NULL, $anchor);
$answers .= '<div class="faq_question">' . l($node->title, "node/{$node->nid}", array(
"name" => "{$anchor}",
)) . "</div>\n";
// should we display teaser or full text
if ($display_vars['use_teaser']) {
$more_link = '';
if (!empty($display_vars['more_link']) && strlen($node->teaser) < strlen($node->body)) {
$more_link = '<p class="faq_more_link">';
$more_link .= l(t($display_vars['more_link']), "node/{$node->nid}") . '</p>';
}
$answers .= '<div class="faq_answer">';
$answers .= check_markup($node->teaser, $node->format, FALSE);
$answers .= $more_link . $back_to_top . "</div>\n";
}
else {
$answers .= '<div class="faq_answer">';
$answers .= check_markup($node->body, $node->format, FALSE);
$answers .= $back_to_top . "</div>\n";
}
}
}
$list_style = variable_get('faq_question_listing', 'ul');
$output = theme('item_list', $questions, NULL, $list_style, array(
"class" => "faq_ul_questions_top",
));
$output .= "<div>\n" . $answers . "</div>\n";
return $output;
}