Friday 03 March 2006 1:37:15 am
Hi,
I'm using a customized version of ezsurvey and wrote an additional test to display a different message if the answer given was correct or wrong (a correct answer is identified by a result value higher than 10)
The 2 piece of template code work fine, displaying 'correct' or 'wrong'. I need to add a counter to be able to show at the end of the page the total number of answers tested as 'correct'. How can I include a counter, and bring it's value back to the first piece of code?
{section var=question loop=$survey_questions}
<div class="block">
{survey_question_result_gui view=item question=$question result_id=$result_id metadata=$survey_metadata}
</div>
{/section}
{$question.question_number}. {$question.text|wash('xhtml')}<br />
{$question.result_id}
{let result=fetch('survey', 'multiple_choice_result_item',
hash( 'question', $question,
'metadata', $metadata,
'result_id', $result_id ))}
{section var=ans loop=$result}
{if $ans['value']|ge( 10 )}
<font color="#008000">{"correct"|i18n("design/gdp")}</font>
{else}
<font color="#ff0000">{"wrong"|i18n("design/gdp")}</font>
{/if}
{section show=$ans['label']|wash('xhtml')|count_chars}{$ans['label']|wash('xhtml')}
{/section}
{delimiter}, {/delimiter}
{/section}
Thanks a lot for an hint. has this to do with the variable scope?
Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch
|