<?php
$q = [
'id' => 1,
'intro' => 'This is the introductory text to the question.',
'img' => ['src' => '/images/1A.png', 'alt' => 'A figure for the question.'],
'parts' => [
'a' => [
'text' => 'Show that this is the first part of the question.',
'subparts' => []
],
'b' => [
'text' => 'Show that this is the second part of the question.',
'subparts' => [
'i' => ['text' => 'This is the subpart of question (b). Prove it.'],
'ii' => ['text' => 'This is the final subpart.']
]
]
]
];
?>
<div class="Question" id="<?= $q['id']; ?>">
<div class="introText">
<p><?= $q['intro']; ?></p>
</div>
<div class="questionFigure">
<img src="<?= $q['img']['src']; ?>" alt="<?= $q['img']['alt']; ?>">
</div>
<?php foreach ($q['parts'] as $a=>$part) : ?>
<div class="letterQuestionText">
<p>(<?= $a; ?>) <?= $part['text']; ?></p>
<?php foreach ($part['subparts'] as $i=>$subpart) : ?>
<div class="romanQuestionText">
<p>(<?= $i; ?>) <?= $subpart['text']; ?></p>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
<div class="Question" id="1">
<div class="introText">
<p>This is the introductory text to the question.</p>
</div>
<div class="questionFigure">
<img src="/images/1A.png" alt="A figure for the question.">
</div>
<div class="letterQuestionText">
<p>(a) Show that this is the first part of the question.</p>
</div>
<div class="letterQuestionText">
<p>(b) Show that this is the second part of the question.</p>
<div class="romanQuestionText">
<p>(i) This is the subpart of question (b). Prove it.</p>
</div>
<div class="romanQuestionText">
<p>(ii) This is the final subpart.</p>
</div>
</div>
</div>