Changes between Version 20 and Version 21 of BoltTutorial
- Timestamp:
- Aug 16, 2008, 7:52:41 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BoltTutorial
v20 v21 22 22 == Lessons and sequences == 23 23 24 Let's start with a simple course consisting of twolessons.24 Let's start with a simple course consisting of 13 lessons. 25 25 Each lesson consists of a PHP or HTML file. 26 Create the following files in ~/projects/test/html/user: 27 28 '''conifer_intro.php''' (the first lesson): 26 The first lesson is '''conifer_intro.php''': 29 27 {{{ 30 28 <?php 31 29 32 30 echo " 31 <h2>California conifers</h2> 32 33 33 Throughout California's Sierra Nevada mountains, 34 34 and especially at high altitudes, 35 the dominant plants are tall, straight 36 trees with narrow needle-like leaves. 37 These trees are called <b>conifers</b> 38 because they carry their seeds in cones. 39 <p> 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 40 57 This course will teach you how to identify 41 58 the most common types of California conifers. 42 43 59 "; 44 60 ?> 45 46 61 }}} 47 62 48 '''conifer_decid.php''' (the second lesson):63 The course structure is defined by '''conifer1.php''': 49 64 {{{ 50 65 <?php 51 66 52 echo " 53 Trees can be classified into two groups: 54 <b>coniferous</b> and <b>deciduous</b>. 55 These groups differ in several ways: 67 require_once("../inc/conifer.inc"); 56 68 57 <ul> 58 <li> Most conifers are 'evergreen': 59 they maintain their leaves throughout the year. 60 Deciduous trees drop their leaves in autumn. 61 <li> Conifer leaves are either needles or overlapping scales, 62 whereas deciduous leaves are broad and flat. 63 64 <ul> 65 "; 66 67 ?> 68 69 }}} 70 71 '''course1.php''' (the 'course document', specifying the course structure 72 and the page headers and footers): 73 {{{ 74 <?php 75 76 function bolt_header($title) { 77 echo " 78 <link rel=stylesheet href=conifer.css type=text/css> 79 <table><tr><td width=600 height=126 background=images/conifers.jpg> 80 <font size=6 color=#ffffff> 81 Identifying<br> California<br> Conifers 82 </font> 83 </td></tr></table> 84 <p> 85 <h2>$title</h2> 86 "; 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 ); 87 85 } 88 86 89 function bolt_footer() { 90 echo " 91 <div id='footer'> 92 <table width=100%><tr><td align=center> 93 © 2008 94 </td></tr></table> 95 </div> 96 "; 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 ); 97 137 } 98 138 99 139 return sequence( 100 140 name('course'), 101 lesson( 102 name('Introduction'), 103 filename('conifer_intro.php') 104 ), 105 lesson( 106 name('Conifers and deciduous trees'), 107 filename('conifer_decid.php') 108 ) 141 intro_lessons(), 142 pine_lessons(), 143 cypress_lessons() 109 144 ); 145 110 146 ?> 111 }}}112 147 113 '''conifer.css''': the CSS stylesheet114 {{{115 body {116 background-color: white;117 font-family: "Trebuchet MS", Verdana, Arial, Sans-Serif;118 font-size: 16px;119 color: black;120 width: 800px;121 }122 123 img {124 display: block;125 margin-top: 10px;126 margin-bottom: 10px;127 margin-left: auto;128 margin-right: auto;129 border: 0px;130 }131 132 p.caption {133 text-align: center;134 font-weight: bold;135 margin-left: auto;136 margin-right: auto;137 }138 148 }}} 139 149