wiki:BoltTutorialExercises

Version 6 (modified by davea, 17 years ago) (diff)

--

Bolt Tutorial, part II: Exercises

Now let's add an exercise. Create a file exercise1.php:

<?php
echo "Conifers are so named because:";
bolt_exclusive_choice(
    array(
        'They carry their seeds in cones',
        'They are cone-shaped',
        'They originated in the Coniceous era',
    )
);
?>

and edit conifer.php:

<?php
...
return sequence(
    name('course'),
    lesson(
        name('Introduction'),
        filename('conifer_intro.php')
    ),
    lesson(
        name('Conifers and deciduous trees'),
        filename('conifer_decid.php')
    ),
    exercise(
        name(''),
        filename('conifer_ex1.php')
    )
);

?>

The course structure is now Start the course from the beginning. When you get to the exercise you'll see

You'll then see either

or

depending on whether you answered the question correctly.

Some notes:

  • The correct answer is always the first choice listed. Bolt automatically randomly reorders the choices to remove any ordering effects.
  • The exercise page is used to generate both the exercise and the answer page.
  • If you look at your course history, you'll see that Bolt has stored your answers to the exercise, and your score, in its database.

Review and repeat

Suppose the student doesn't perform the exercise correctly, and you want to let them (or require them to) review the lessons and repeat the exercise?

Attachments (5)

Download all attachments as: .zip