{else} {* alle Antworten durchlaufen lassen, um zu prüfen, ob die eingegebene Antwort korrekt ist oder nicht *} {foreach $answers.$question_id as $answer_id => $answer} {* hier jetzt konkret prüfen, ob die gemachte Antwort korrekt ist oder nicht *} {if $post.var1.$question_id|lower == $answer.text|lower && $answer.false != 1} {$show_text.right_answer|replace:'[question_id]':$question_id}
{$questions.$question_id.right = 1} {$num_questions_right = $num_questions_right + 1} {break} {/if} {/foreach} {* falls keine der geprüften Antworten korrekt war, wurde die Frage falsch beantwortet *} {if $questions.$question_id.right != 1} {$show_text.wrong_answer|replace:'[question_id]':$question_id}
{/if} {/if} {/foreach} {* Workaround, damit bei keinen richtig beantworteten Fragen eine 0 angezeigt wird *} {if !$num_questions_right} {$num_questions_right = 0} {/if}
{$show_text.result|replace:'[num_questions_right]':$num_questions_right|replace:'[num_questions_total]':$num_questions_total}
{/if} {* Formular ausgeben (mit Fragen und Antwortfeldern, etc. *}