| 103 | | |
| 104 | | == Exercises == |
| 105 | | |
| 106 | | Now let's add an exercise. |
| 107 | | Create a file "exercise1.php": |
| 108 | | {{{ |
| 109 | | <?php |
| 110 | | echo "Conifers are so named because:"; |
| 111 | | bolt_exclusive_choice( |
| 112 | | array( |
| 113 | | 'They carry their seeds in cones', |
| 114 | | 'They are cone-shaped', |
| 115 | | 'They originated in the Coniceous era', |
| 116 | | ) |
| 117 | | ); |
| 118 | | ?> |
| 119 | | }}} |
| 120 | | |
| 121 | | and edit course_doc.php: |
| 122 | | {{{ |
| 123 | | <?php |
| 124 | | return sequence( |
| 125 | | name('course'), |
| 126 | | lesson( |
| 127 | | name('lesson 1'), |
| 128 | | filename('lesson1.php') |
| 129 | | ), |
| 130 | | lesson( |
| 131 | | name('lesson 2'), |
| 132 | | filename('lesson2.html') |
| 133 | | ), |
| 134 | | exercise( |
| 135 | | name('exercise 1'); |
| 136 | | filename('exercise1.php'); |
| 137 | | ) |
| 138 | | ); |
| 139 | | ?> |
| 140 | | }}} |
| 141 | | |
| 142 | | Start the course from the beginning. |
| 143 | | When you get to the exercise you'll see |
| 144 | | |
| 145 | | [[Image(ex.png, nolink)]] |
| 146 | | |
| 147 | | You'll then see either |
| 148 | | |
| 149 | | [[Image(right.png, nolink)]] |
| 150 | | |
| 151 | | or |
| 152 | | |
| 153 | | [[Image(wrong.png, nolink)]] |
| 154 | | |
| 155 | | depending on whether you answered the question correctly. |