[eluser]oldblueday[/eluser]
Absolutely. Thanks, mddd. However I am having a problem, which I'm hoping has a simple solution.
Code:
<p>Loose snow avalanche!!!!</p>
<p>The avalanche roared down crushing one of the shelter walls and covering the shelter with up to 3 meters of snow. Many of the people made it out of the shelter on their own, but others had to be assisted.</p>
</div>
<?php
// if I call a bunch of functions via a procedure, it doesn't work
echo print_scenario_question($scenario_questions[0], $ans_key);
// however if I call the functions outright, it works well
// $q = $this->quizmaker->generate_question($scenario_questions[0]);
// echo $q['HTML_question'];
// $ans_key[] = $q['answer_key'];
?>
<?php echo form_close(); ?>
</div>
<?php
/* --------------------------------------------------------------------------------
* PRINT SCENARIO QUESTION
*
* just shorthand to generate the HTML string for the question and update
* the answer key
*
* --------------------------------------------------------------------------------
*/
function print_scenario_question($question, &$ak)
{
$q = $this->quizmaker->generate_question($question);
$html .= "<li>" . $q['HTML_question'] . "</li>";
$ak[] = $q['answer_key'];
return $html;
}
I've narrowed it down to the calling of the $this->quizmaker->generate_question($question) call. Why would it work well inline but not when called from a procedure?
I noticed that you had translated my
Code:
<?php
$this->questions->_print_scenario_question($scenario_questions[0], $html_quiz, $ans_key);
$this->questions->_print_scenario_question($scenario_questions[1], $html_quiz, $ans_key);
$this->questions->_print_scenario_question($scenario_questions[2], $html_quiz, $ans_key);
?>
...into...
Code:
<?php
$questions->_print_scenario_question($scenario_questions[0], $html_quiz, $ans_key);
$questions->_print_scenario_question($scenario_questions[1], $html_quiz, $ans_key);
$questions->_print_scenario_question($scenario_questions[2], $html_quiz, $ans_key);
?>
Does the $this object not need to be there? I tried removing it with no luck, though.
Thanks-Rahul