Is it possible to number the questions and answers?
(5 posts) (4 voices)-
HI
I love this plugin: It is so simple!
Is there a way to number the questions: eg question 1 of 14, question 2 of 14 and so on?
Likewise is it possible to get the question numbers on the results page?
ThanksPosted 2 years ago # -
Good idea - I'll add this feature in the next release.
Glad to know you enjoyed the plugin
Posted 2 years ago # -
Hi,
i use this plug-in in my page [url:48c0vvz7]http://acikogretimx.com/[/url:48c0vvz7] and my all questions showing a page.
İ wish your plugin to add to numbers of all questions head, next version of quizzin.
thanks.Posted 2 years ago # -
Edit quizzin/show_quiz.php...
STEP BY STEP
1 - first line added totaly new $question_count = 1;
2- add $question_count . '. ' . 3th line
3- add $question_count++; 3th line at last
4- add $question_count . '. ' . in second part
$question_count = 1;
foreach ($all_question as $ques) {
$result .= "<div class='show-question'>";
$result .= "<div class='show-question-content'>". $question_count . '. ' . stripslashes($ques->question) . "</div>\n";
$all_answers = $wpdb->get_results("SELECT ID,answer,correct FROM {$wpdb->prefix}quiz_answer WHERE question_id={$ques->ID} ORDER BY sort_order");
$correct = false;
$result .= "<ul>";
foreach ($all_answers as $ans) {
$class = 'answer';
if($ans->ID == $_REQUEST["answer-" . $ques->ID]) $class .= ' user-answer';
if($ans->correct == 1) $class .= ' correct-answer';
if($ans->ID == $_REQUEST["answer-" . $ques->ID] and $ans->correct == 1) {$correct = true; $score++;}
$result .= "<li class='$class'>" . stripslashes($ans->answer) . "</li>\n";
}
$result .= "</ul>";
if(!$_REQUEST["answer-" . $ques->ID]) $result .= "<p class='unanswered'>" . t('you dont answer it.') . "</p>";
$result .= "<p class='explanation'>" . stripslashes($ques->explanation) . "</p>";
$result .= "</div>";
$question_count++;
$total++;
}
second part is ...
foreach ($all_question as $ques) {
echo "<div class='question' id='question-$question_count'>";
echo "<div class='question-content'>". $question_count . '. ' . stripslashes($ques->question) . "</div><br />";
echo "<input type='hidden' name='question_id[]' value='{$ques->ID}' />";
$dans = $wpdb->get_results("SELECT ID,answer FROM {$wpdb->prefix}quiz_answer WHERE question_id={$ques->ID} ORDER BY sort_order");
foreach ($dans as $ans) {
echo "<input type='radio' name='answer-{$ques->ID}' id='answer-id-{$ans->ID}' class='answer' value='{$ans->ID}' />";
Posted 2 years ago # -
Hello,
I have installed the latest version of the plugin (which seems to contain the above code) but my questions are still un-numbered. Any ideas?
Thanks!Posted 1 year ago #
Reply
You must log in to post.