| 1 | = Bolt Tutorial, part II: Exercises = |
| 2 | |
| 3 | Now let's add an exercise. |
| 4 | Create a file "exercise1.php": |
| 5 | {{{ |
| 6 | <?php |
| 7 | echo "Conifers are so named because:"; |
| 8 | bolt_exclusive_choice( |
| 9 | array( |
| 10 | 'They carry their seeds in cones', |
| 11 | 'They are cone-shaped', |
| 12 | 'They originated in the Coniceous era', |
| 13 | ) |
| 14 | ); |
| 15 | ?> |
| 16 | }}} |
| 17 | |
| 18 | and edit course_doc.php: |
| 19 | {{{ |
| 20 | <?php |
| 21 | return sequence( |
| 22 | name('course'), |
| 23 | lesson( |
| 24 | name('lesson 1'), |
| 25 | filename('lesson1.php') |
| 26 | ), |
| 27 | lesson( |
| 28 | name('lesson 2'), |
| 29 | filename('lesson2.html') |
| 30 | ), |
| 31 | exercise( |
| 32 | name('exercise 1'); |
| 33 | filename('exercise1.php'); |
| 34 | ) |
| 35 | ); |
| 36 | ?> |
| 37 | }}} |
| 38 | |
| 39 | Start the course from the beginning. |
| 40 | When you get to the exercise you'll see |
| 41 | |
| 42 | [[Image(ex.png, nolink)]] |
| 43 | |
| 44 | You'll then see either |
| 45 | |
| 46 | [[Image(right.png, nolink)]] |
| 47 | |
| 48 | or |
| 49 | |
| 50 | [[Image(wrong.png, nolink)]] |
| 51 | |
| 52 | depending on whether you answered the question correctly. |