1 |
dpavlin |
1.1 |
<? |
2 |
|
|
|
3 |
|
|
require("cyclic_arr.class.php"); |
4 |
|
|
require("bg_color.class.php"); |
5 |
|
|
|
6 |
|
|
$nr_lines = 13; |
7 |
|
|
|
8 |
|
|
$a=new Cyclic_Arr; |
9 |
|
|
$a->set_size($nr_lines); |
10 |
|
|
|
11 |
|
|
$b=new Bg_Color; |
12 |
|
|
$b->colors("#ff8888","#88ff88"); |
13 |
|
|
|
14 |
|
|
// read file in cyclic array |
15 |
|
|
$fd = fopen("/home/dpavlin/foo", "r"); |
16 |
|
|
while (!feof ($fd)) { |
17 |
|
|
$line=fgets($fd, 4096); |
18 |
|
|
if ($line != "") $a->push($line); |
19 |
|
|
} |
20 |
|
|
fclose ($fd); |
21 |
|
|
|
22 |
|
|
// generate html |
23 |
|
|
print "<table>\n"; |
24 |
|
|
$a->next; // move to next (oldest one) |
25 |
|
|
for ($i=0; $i<$nr_lines; $i++) { |
26 |
|
|
print "<tr".$b->bgcolor()."><td>$i:</td><td>".$a->tell_pos()."</td><td>".$a->fetch()."</td></tr>\n"; |
27 |
|
|
} |
28 |
|
|
print "</table>\n"; |
29 |
|
|
|
30 |
|
|
?> |