-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab8.php
297 lines (260 loc) · 11.1 KB
/
lab8.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<!DOCTYPE html>
<html>
<head>
<title>Lab 8 - First Data Tables - Directions</title>
<meta charset="utf-8" />
<link rel="icon" href="images/favicon.ico" type="image/ico"/>
<link rel="icon" href="images/favicon.gif" type="image/gif"/>
<link rel="icon" href="images/favicon.png" type="image/png"/>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>
<div id="wrapper">
<?php include("includes/header.php"); ?>
<div class="clearfix">
<section id="main">
<h1 class="lab-header">Lab 8: First Data Tables</h1>
<p>Tables are used to organize information in row and column format.</p>
<div class="thumbnail">
<img src="images/peek.jpg" alt="Sneak A Peek " class="peek" />
<p>In this lab we're only adding a table to the harvest and blog pages.
Look at this <a href="labs/8/index.html" target="_blank">home
page</a>. Still just a work in progress. But progress, none-the-less!!</p>
</div>
<h2>Step 1: Let's begin with the "Vegetables And Their Due Dates" table
on the harvest page.</h2>
<p>Our table for the harvest.html page goes just after:</p>
<p><code><p></code>It would be nice to time the planting so that I could
schedule the harvest. Maybe if I worked off a table like this I could do a
better job with planting so everything would ripen about the same time.<code></p></code></p>
<p>It all starts with</p>
<p><code><table> </code></p>
<p>and ends with </p>
<p><code></table></code></p>
<p>and everything in the table goes inside of those tags. Simple enough and just
like everything you already know about HTML.</p>
<p>So just after the opening table tag let's add a caption to our table. That's
a pretty common thing to do.</p>
<p><code><caption></code>Vegetables And Their Due Dates<code></caption></code></p>
<p>After the caption let's add in the thead section like this:</p>
<p><code><thead><br>
<tr><br>
<th></code>Vegetable<code></th><br>
<th></code>Days To Maturity<code></th><br>
<th></code>Date To Pick<code></th><br>
<th></code>Yield<code></th><br>
</tr><br>
</thead></code></p>
<p><code><thead></code> is a used to group the first row as the head part of the table. Grouping
is what we will get into in the next lesson but I thought I'd give you a grouping
tag right here. Like anything to do with HTML it is used to build the structure
of our page.</p>
<p>Inside <code><thead></thead></code> we have one row formed by the <code><tr></code> tag
and four columns (cells) formed by the <code><th></code> element.</p>
<p>Don't copy and paste the above. Type out all the code. You can do it!! In
fact, you have to do it!!</p>
<p>The next four rows make up the <code><tbody></tbody></code> section so let's just start
with </p>
<p><code><tbody></code></p>
<p><code></tbody></code></p>
<p>and have all four rows fit inside of that container.</p>
<p>The first row in the tbody section (that would be the second row of our table)
goes like this:</p>
<p><code><tr><br>
<th></code>Early Girl<code></th><br>
<td></code>90<code></td><br>
<td></code>Aug 12<code></td><br>
<td></code>8<code></td><br>
</tr></code></p>
<p>This time we are using <code><td></code> rather than <code><th></code> as this
is just a garden variety (get it - garden variety) table cell and not a heading
cell which is what <code><th></code> is for.</p>
<p>OK, now let's see if you can do the last three rows. The pattern you will
use is exactly as what I did for the row just completed.</p>
<p>Let me give you the data and you can complete each row.</p>
<p>For the third row, the data, from the left cell to the right cell, is:</p>
<ol>
<li>Supersonic Tomato</li>
<li>110</li>
<li>Sept 1</li>
<li>15</li>
</ol>
<p>For the fourth row it's:</p>
<ol>
<li>Breakfast Radish</li>
<li>35</li>
<li>June 17</li>
<li>n/a</li>
</ol>
<p>And the final row is:</p>
<ol>
<li>Zucchini</li>
<li>50</li>
<li>Jul 2</li>
<li>15</li>
</ol>
<p>Just as a reminder, this last row will go just before <code></tbody></code>.</p>
<p>And the entire table finished with a <code></table></code>.</p>
<p>All the principles of HTML are intact. For every open tag there is a close
tag and the tags were closed in the reverse order in which they were opened.
This table had one row that was inside the <code></thead></code> section with the rows that
followed all inside of the <code><tbody></code> section.</p>
<p>Check my source code if you haven't already and then, of course, validate
this page.</p>
<h2>Step 2: Now that we know how to make a table let's add the two tables for
the blog page.</h2>
<p>We'll begin with the table that concerns pH soil factors for my garden. This
table is a lot like what you did for the harvestpage but I didn't use a caption.
I used <code><thead></code> and <code><tbody></code> and this
time I added in <code><tfoot></code> which
I wrapped around the last row.</p>
<p>Our table has 2 columns and 13 rows.</p>
<p>Just after</p>
<p><code><p></code>Here is a table of pH factors I found while doing some research for this article that will help explain all of this.<code></p></code></p>
<p>type in </p>
<p><code><table></code></p>
<p>to get the ball rolling.</p>
<p>Then add the thead section like this which contains our first row:</p>
<p><code><thead><br>
<tr><br>
<th></code>Denomination<code></th><br>
<th></code>pH range<code></th><br>
</tr><br>
</thead></code></p>
<p>Now, here's the data for the next eleven rows. All of these rows will go inside
of <code><tbody></code> and <code></tbody></code>. Don't forget, the rows start and end with <code><tr></code> and <code></tr></code> and
the cells inside of the each row start with <code><td></code> and end
with <code></td></code>.</p>
<table width="100%" border="0">
<caption>
Use This Data For The pH Factors Table
</caption>
<tr>
<th scope="col"> </th>
<th scope="col">Left Cell</th>
<th scope="col">Right Cell</th>
</tr>
<tr>
<th scope="row">2nd Row</th>
<td>Ultra acid</td>
<td>3.5</td>
</tr>
<tr>
<th scope="row">3rd Row</th>
<td>Extremely acid</td>
<td>3.5 - 4.4</td>
</tr>
<tr>
<th scope="row">4th Row</th>
<td>Very strongly acid</td>
<td>4.5 - 5.0</td>
</tr>
<tr>
<th scope="row">5th Row</th>
<td>Strongly acid</td>
<td>5.1 - 5.5</td>
</tr>
<tr>
<th scope="row">6th Row</th>
<td>Moderately acid</td>
<td>5.6 - 6.0</td>
</tr>
<tr>
<th scope="row">7th Row</th>
<td>Slightly acid</td>
<td>6.1 - 6.5</td>
</tr>
<tr>
<th scope="row">8th Row</th>
<td>Neutral</td>
<td>6.6 - 7.3</td>
</tr>
<tr>
<th scope="row">9th Row</th>
<td>Slightly alkaline</td>
<td>7.4 - 7.8</td>
</tr>
<tr>
<th scope="row">10th Row</th>
<td>Moderately alkaline</td>
<td>7.9 - 8.4</td>
</tr>
<tr>
<th scope="row">11th Row</th>
<td>Strongly alkaline</td>
<td>8.5 - 9.0</td>
</tr>
<tr>
<th scope="row">12th Row</th>
<td>Very strongly alkaline</td>
<td>9.0</td>
</tr>
</table>
<p>The last row - in this case it's the footer row - will go inside of <code><tfoot></code> and <code></tfoot></code>.
But this time the row has only one cell so you'll need to use the colspan
attribute like this</p>
<p><code><td colspan="2"></code></p>
<p>so that the cell will span across the two cells just above it. </p>
<p>The text inside of the cell is</p>
<p>Source: Soil pH </p>
<p>and the link to Soil pH is <code>http://en.wikipedia.org/wiki/Soil_ph</code> (copy
and paste the url please!!). </p>
<p>So, the link goes inside of the cell, the cell inside of the row and the row
goes inside of the tfoot element. Just make sure all of your open tags are
closed as always.</p>
<p>Might want to validate your page before you do the next table.</p>
<hr>
<p>Our last table is a calendar which starts just after:</p>
<p><code><h2></code>Previous Articles<code></h2></code></p>
<p>The first two rows are inside of the thead section.</p>
<p>The first row which has only one cell (and holds the word "August")
has to span 7 cells (columns) and it's done with:</p>
<p><code><th colspan="7"></code></p>
<p>I hope I don't need to remind you that every row has to start and end with <code> <tr></code> and <code></tr></code> and
the cell in this case must end with <code></th></code>.</p>
<p>The second row has seven cells, one for each day of the week. Again, I am
using the th container as these cells are the heads for each column.</p>
<p>Once you get to the third row use the td container for all the dates.
Let me show you the third row because it might be tricky.</p>
<p><code><tbody><br> <tr><br>
<td colspan="3"></td><br>
<td></code>1<code></td><br>
<td></code>2<code></td> <br>
<td><a href="#"></code>3<code></a></td><br>
<td>4</td><br>
</tr></code></p>
<p>I used <code><tbody></code> to start the rows containing the dates and,
of course, I have to finish the last with a closing <code></tbody></code> which
will come after the final <code></tr></code>.</p>
<p>When spanning columns always make sure to use a value that, when added to the
cells that have data in them, will equal the largest numbers of cells in any
row. In this table we have seven cells and, in the above example, the first three
cells are spanned and the remaining four cells have data in each cell. That's
a total of seven.</p>
<p>Think back to our first row when we used <code> colspan="7"</code> to span all seven columns
in every row.</p>
<p>The next three rows are smooth sailing. Each row has seven columns (cells)
and each cell holds one date.</p>
<p>But watch out for that last row. When you get to "31" you are going
to need the columns attribute so that you will have a total of seven columns.
That's all I'm going to tell you. </p>
<p>Just a reminder. Make sure to end this section with <code></tbody></code> and
then finish the table with <code></table></code>.</p>
<p>Oh yes, some of the cells are faux links (links to non-existent) pages which
I did just for practice. Feel free to include these links in your calendar
as you see fit. For
example, if you want to make Day 3 a link, here is the code that goes inside
the td container:</p>
<p><code><a href="#">3</a></code> or <code><a href=""></code>3<code></a></code> is
valid too.</p>
<p>And that's it. Your two tables for the blog page are set. Have you been validating
all along? If not, make sure this page and index are in good shape (error free)
before going on.</p>
</section>
</div> <!-- ned clearfix -->
<?php include("includes/footer.php"); ?>
</div> <!-- end wrapper -->
</body>
</html>