26 | | The first lesson is '''conifer_intro.php''': |
| 30 | For example, the first lesson is |
| 31 | [/browser/trunk/bolt_examples/user/conifer_intro.php conifer_intro.php]. |
| 32 | |
| 33 | The course structure is defined by a "course document", |
| 34 | [/browser/trunk/bolt_examples/inc/conifer1.php]. |
| 35 | |
| 36 | A course document is like an outline for the course; |
| 37 | it is a hierarchy of '''units'''. |
| 38 | The bottom-level unites are '''lessons''' and '''exercises'''. |
| 39 | Each lesson is specified by: |
28 | | <?php |
29 | | |
30 | | echo " |
31 | | <h2>California conifers</h2> |
32 | | |
33 | | Throughout California's Sierra Nevada mountains, |
34 | | and especially at high altitudes, |
35 | | the dominant plants are tall, straight trees called <b>conifers</b>. |
36 | | Conifers are remarkable in many ways: |
37 | | <ul> |
38 | | <li> They have existed in approximately their current form |
39 | | for 240 million years. |
40 | | <li> |
41 | | They display remarkable tenacity and adaptibility, |
42 | | managing to grow in the most unlikely places: |
43 | | <img src=jeffrey_pine.jpg> |
44 | | <p class=caption>A Jeffrey pine growing on granite in the High Sierra</p> |
45 | | <li> The largest living thing is a conifer: |
46 | | the General Sherman, a Giant Sequoia in Sequoia National Park. |
47 | | Its trunk volume is 52,500 cubic feet. |
48 | | <img src=general_sherman.jpg> |
49 | | <li> |
50 | | The oldest known living thing is a conifer: |
51 | | a 4,500-year-old bristlecone pine in the White Mountains |
52 | | (a mountain range that neighbors the Sierra Nevada). |
53 | | <img src=bristlecone-pine.jpg> |
54 | | <p class=caption>A bristlecone pine.</p> |
55 | | </ul> |
56 | | |
57 | | This course will teach you how to identify |
58 | | the most common types of California conifers. |
59 | | "; |
60 | | ?> |
| 41 | lesson( |
| 42 | filename("file_name") |
| 43 | ) |
69 | | function intro_lessons() { |
70 | | return sequence( |
71 | | name('intro lessons'), |
72 | | lesson( |
73 | | title('Introduction'), |
74 | | filename('conifer_intro.php') |
75 | | ), |
76 | | lesson( |
77 | | title('Conifers and deciduous trees'), |
78 | | filename('conifer_decid.php') |
79 | | ), |
80 | | lesson( |
81 | | title('Conifers taxonomy'), |
82 | | filename('taxonomy.html') |
83 | | ) |
84 | | ); |
85 | | } |
86 | | |
87 | | function cypress_lessons() { |
88 | | return sequence( |
89 | | name('Cypress genera'), |
90 | | lesson( |
91 | | title('Incense-Cedar'), |
92 | | filename('incense-cedar.html') |
93 | | ), |
94 | | lesson( |
95 | | title('Juniper'), |
96 | | filename('juniper.html') |
97 | | ), |
98 | | lesson( |
99 | | title('Coast Redwood'), |
100 | | filename('coast-redwood.html') |
101 | | ), |
102 | | lesson( |
103 | | title('Giant Sequoia'), |
104 | | filename('giant-sequoia.html') |
105 | | ), |
106 | | lesson( |
107 | | title('Red Cedar'), |
108 | | filename('red-cedar.html') |
109 | | ) |
110 | | ); |
111 | | } |
112 | | |
113 | | function pine_lessons() { |
114 | | return random( |
115 | | name('Pine genera'), |
116 | | lesson( |
117 | | title('Pines'), |
118 | | filename('pine.html') |
119 | | ), |
120 | | lesson( |
121 | | title('Spruces'), |
122 | | filename('spruce.html') |
123 | | ), |
124 | | lesson( |
125 | | title('Douglas Fir'), |
126 | | filename('douglas-fir.html') |
127 | | ), |
128 | | lesson( |
129 | | title('Hemlock'), |
130 | | filename('hemlock.html') |
131 | | ), |
132 | | lesson( |
133 | | title('Firs'), |
134 | | filename('fir.html') |
135 | | ) |
136 | | ); |
137 | | } |
138 | | |
| 61 | The course document is a PHP file. |
| 62 | It must return a Bolt control structure. |
| 63 | In this case, this is done as follows (lines 75-79): |
| 64 | {{{ |