[eluser]mr lister[/eluser]
Ah yes, I see how that works.
I am still getting over the Dreamweaver / Developer Toolbox way of doing things - using their nested loops.
The M-V-C concept is far different to what I was used too, but I think is it a far better way of doing things.
[Edit]
Actually, the more I think about it, the more confused I am about it... in the
foreach loop you would have to have some conditional statement that checks the 'id' value.
Something along the lines of?:
Code:
<?php
// declare a value outside the loop to check question id
// i think you have to declare the variable in the controller
// and pass it to the view??
$id_value = 0;
?>
<?php foreach($questions as $question) ?>
<?php
if ( $id_value != $question->id )
{ // initially $id_value = 0, so condition is true
// so show the question.
?>
<p><strong><?php echo $question->questioncontent ?></strong></p>
<?php
// since the 'if' statement is true and the question
// shown the first time, put the $question->id into
// the $id_value
$id_value = $question->id;
}
?>
<?php echo $question->answercontent ?>
<?php endforeach; ?>
That should work?