3 * Pretty-print lists of people from xml data. For example:
4 * include('php/people.php');
5 * $use_pictures = true;
6 * printPeopleStart($use_picture);
7 * $s=simplexml_load_file('xml/profs.xml');
8 * printPeople('Professors', $s, $use_pictures);
9 * $s=simplexml_load_file('xml/TAs.xml');
10 * printPeople('Teaching Assistants', $s, $use_pictures);
11 * printPeopleEnd($use_picture);
13 * simplexml_load_file idea from 2008 courselist page
14 * http://www.physics.drexel.edu/students/courses/
15 * COPYRIGHT © 2008 DREXEL UNIVERSITY DEPARTMENT OF PHYSICS
16 * Design by Daniel J. Cross
18 function printPeopleStart($use_pictures){
19 if ($use_pictures == false)
22 function printPeopleEnd($use_pictures){
23 if ($use_pictures == false)
26 function printPeople($title, $people, $use_pictures){
27 if ($use_pictures == true)
28 echo " <h3 style=\"clear: both;\">$title</h3>\n";
30 echo " <tr><th colspan=\"3\">$title</th></tr>\n";
31 foreach($people->person as $person){
33 if (strlen($person->url) > 0){
34 $href=" href=\"".$person->url."\"";
38 $office=$person->office;
39 $email=$person->email;
40 $hours=$person->hours;
41 $picture=$person->picture;
42 $extension=$person->extension;
43 if ($use_pictures == true) {
44 echo " <div class=\"person\" style=\"clear: both;\">\n";
45 echo " <img alt=\"$name\" src=\"$picture\" width=\"100px\" height=\"130px\" style=\"float:left;margin-right:10px;border:1px solid black;\"/>\n";
47 echo " <b><a$href>$name</a></b><br/>\n";
48 echo " Email: $email<br/>\n";
49 echo " Office: $office<br/>\n";
50 echo " Hours: $hours<br/>\n";
51 echo " Extension: $extension<br/>\n";
55 echo " <tr><td><a$href>$name</a></td><td>$office</td><td>$email</td></tr>\n";
56 if (strlen($hours) > 0){
57 echo " <tr><td></td><td colspan=\"2\">Office hours: $hours</td></tr>\n";