$answerids = array_slice($answerids, $pagestart, $pagesize); foreach ($answerids as $answerid) { $answer = $answers[$answerid]; if (!($formtype == 'a_edit' && $formpostid == $answerid)) { $a_view = qa_page_q_answer_view($question, $answer, $answer['isselected'], $usershtml, $formrequested); // Prepare content for comments on this answer, plus add or edit comment forms if ($formtype == 'c_add' && $formpostid == $answerid || $answer['commentbutton'] && !$formrequested) { // ...to be added $a_view['c_form'] = qa_page_q_add_c_form($qa_content, $question, $answer, 'c' . $answerid, $captchareason, @$cnewin[$answerid], @$cnewerrors[$answerid], $formtype == 'c_add'); if ($formtype == 'c_add' && $formpostid == $answerid) { $jumptoanchor = 'c' . $answerid; $commentsall = $answerid; } } elseif ($formtype == 'c_edit' && @$commentsfollows[$formpostid]['parentid'] == $answerid) { // ...being edited $a_view['c_form'] = qa_page_q_edit_c_form($qa_content, 'c' . $formpostid, $commentsfollows[$formpostid], @$ceditin[$formpostid], @$cediterrors[$formpostid]); $jumptoanchor = 'c' . $formpostid; $commentsall = $answerid; } $a_view['c_list'] = qa_page_q_comment_follow_list($question, $answer, $commentsfollows, $commentsall == $answerid, $usershtml, $formrequested, $formpostid); // ...for viewing // Add the answer to the list $qa_content['a_list']['as'][] = $a_view; } } if ($question['basetype'] == 'Q') { $qa_content['a_list']['title_tags'] = 'id="a_list_title"'; if ($countfortitle > 0) { $split = $countfortitle == 1 ? qa_lang_html_sub_split('question/1_answer_title', '1', '1') : qa_lang_html_sub_split('question/x_answers_title', $countfortitle); if ($microdata) { $split['data'] = '<span itemprop="answerCount">' . $split['data'] . '</span>';
$a_view['form']['buttons']['follow'] = array('tags' => 'NAME="dofollowa_' . qa_html($answerid) . '"', 'label' => qa_lang_html('question/follow_button'), 'popup' => qa_lang_html('question/follow_a_popup')); } if ($answer['commentbutton']) { $a_view['form']['buttons']['comment'] = array('tags' => 'NAME="docommenta_' . qa_html($answerid) . '"', 'label' => qa_lang_html('question/comment_button'), 'popup' => qa_lang_html('question/comment_a_popup')); } } // Prepare content for comments on this answer, plus add or edit comment forms $a_view['c_list'] = qa_page_q_comment_follow_list($answer); // ...for viewing if ($formtype == 'c_add' && $formpostid == $answerid) { // ...to be added $a_view['c_form'] = qa_page_q_add_c_form($answerid); } else { if ($formtype == 'c_edit' && @$commentsfollows[$formpostid]['parentid'] == $answerid) { // ...being edited $a_view['c_form'] = qa_page_q_edit_c_form($formpostid, $answerid); } } // Determine this answer's place in the order on the page if ($answer['hidden']) { $a_view['priority'] = 10000 + $priority++; } elseif ($answer['isselected'] && qa_opt('show_selected_first')) { $a_view['priority'] = 0; } else { $a_view['priority'] = 5000 + $priority++; } // Add the answer to the list $qa_content['a_list']['as'][] = $a_view; } } qa_sort_by($qa_content['a_list']['as'], 'priority');