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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
table {
width:100%;
border-collapse:collapse;
}
td {
border: solid 1px black;
padding: 5px;
}
</style>
</head>
<body>
<h2>Resources</h2>
<?php
// include class file
include 'XML/RDDL.php';
// create RDDL parser
// parse RDDL file
$rddl = new XML_RDDL();
$rddl->parseRDDL('example.html');
// get all resources as array
// format as table
$resources = $rddl->getAllResources();
if (is_array($resources) && count($resources) > 0) {
?>
<table>
<tr>
<td>Resource</td>
<td>Description</td>
<td>Purpose</td>
<td>Role</td>
</tr>
<?php
foreach ($resources as $r) {
$purpose = explode('#', $r['arcrole']);
?>
<tr>
<td><a href="<?php echo $r['href']; ?>"><?php echo $r['href']; ?></a></td>
<td><?php echo $r['title']; ?></td>
<td><?php echo $purpose[1]; ?></td>
<td><a href="<?php echo $r['role']; ?>"><?php echo $r['role']; ?></a></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</body>
</html>
|