-
Notifications
You must be signed in to change notification settings - Fork 156
/
index.php
52 lines (50 loc) · 1016 Bytes
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pattern Primer</title>
<link rel="stylesheet" href="global.css">
<style>
.pattern {
clear: both;
overflow: hidden;
}
.pattern .display {
width: 65%;
float: left;
}
.pattern .source {
width: 30%;
float: right;
}
.pattern .source textarea {
width: 90%;
}
</style>
</head>
<body>
<?php
$files = array();
$handle=opendir('patterns');
while (false !== ($file = readdir($handle))):
if(substr($file, -5) == '.html'):
$files[] = $file;
endif;
endwhile;
sort($files);
foreach ($files as $file):
echo '<div class="pattern">';
echo '<div class="display">';
include('patterns/'.$file);
echo '</div>';
echo '<div class="source">';
echo '<textarea rows="6" cols="30">';
echo htmlspecialchars(file_get_contents('patterns/'.$file));
echo '</textarea>';
echo '<p><a href="patterns/'.$file.'">'.$file.'</a></p>';
echo '</div>';
echo '</div>';
endforeach;
?>
</body>
</html>