The best way to learn how to use the WebCore is by example. See the documentation for more information.
The requested URL is always shown first; if a page uses one or more WebCore templates, those are shown afterwards.
00 <?php
01 include_once ('quake/init.php');
02
03 $character = read_var ('character');
04 if (! $character)
05 {
06 $character = 'Anarki';
07 }
08
09 $Page->title->subject = "Warriors - $character";
10
11 $Page->location->append ("Quake III Arena", "./");
12 $Page->location->append ("Characters");
13 $Page->location->append ("<span class=\"field\">$character</span>");
14
15 $Page->start_display ();
16 ?>
17 <div class="main-box">
18 <div class="columns text-flow">
19 <div class="left-sidebar">
20 <ul>
21 <?php
22 $Page->ensure_database_exists ();
23 $db = $Page->database;
24 $db->query ("SELECT name FROM quake_iii_bots ORDER BY name ASC");
25
26 while ($db->next_record ())
27 {
28 $entry = '<a';
29 if ($character == $db->f ("name"))
30 {
31 $entry .= ' class="selected"';
32 }
33 $entry .= ' href="warriors.php?character=' . $db->f ("name") . '">' . $db->f ("name") . '</a>';
34 ?>
35 <li><?php echo $entry; ?></li>
36 <?php
37 }
38 ?>
39 </ul>
40 </div>
41 <div>
42 <?php
43 $db->query ("SELECT * FROM quake_iii_bots WHERE name = '$character'");
44 if ($db->next_record ())
45 {
46 $image_url = new URL ('{data}quake/images/warriors/');
47 $image_url->append ('p_' . $db->f ("image"));
48 $image_url->replace_extension ('jpg');
49 $image_href = $Page->resolve_file ($image_url->as_text ());
50
51 $thumb_url = new URL ('{data}quake/images/warriors/');
52 $thumb_url->append ('p_' . $db->f ("image") . '_tn');
53 $thumb_url->replace_extension ('jpg');
54 $thumb_src = $Page->resolve_file ($thumb_url->as_text ());
55
56 $height = $db->f ("height");
57 $feet = floor ($height / 12);
58 $inches = $height % 12;
59 ?>
60 <h2><?php echo $db->f ("name"); ?></h2>
61 <p>
62 <a class="align-right" href="<?php echo $image_href; ?>"><img src="<?php echo $thumb_src; ?>" alt="<?php echo $db->f ("name"); ?>"></a>
63 </p>
64 <table class="basic columns left-labels">
65 <tr>
66 <th>Height</th>
67 <td><?php echo $feet;?>' <?php echo $inches ?>"</td>
68 </tr>
69 <tr>
70 <th>Weight</th>
71 <td><?php echo $db->f ("weight"); ?> pounds</td>
72 </tr>
73 <tr>
74 <th>Genotype</th>
75 <td><?php echo $db->f ("genotype"); ?></td>
76 </tr>
77 <tr>
78 <th>Gender</th>
79 <td><?php echo $db->f ("gender"); ?></td>
80 </tr>
81 </table>
82 <p><?php echo $db->f ("description"); ?></p>
83 <?php
84 }
85 ?>
86 <p class="info-box-bottom">
87 Screenshots Courtesy of <a href="http://www.idsoftware.com/">id software</a> and <a href="http://q3a.stomped.com/">Stomped</a>.
88 All images and names © <a href="http://www.idsoftware.com/">id software</a>.
89 </p>
90 </div>
91 </div>
92 </div>
93 <?php $Page->finish_display (); ?>
94
95