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 $Page->title->subject = 'Maps';
04
05 $Page->location->append ("Quake III Arena", "./");
06 $Page->location->append ("Maps");
07
08 $Page->start_display ();
09 ?>
10 <div class="main-box">
11 <div class="text-flow">
12 <?php
13 $Page->ensure_database_exists ();
14 $db = $Page->database;
15 $db->query ("SELECT * FROM quake_iii_maps ORDER BY date DESC");
16
17 while ($db->next_record ())
18 {
19 $image_url = new URL ('{data}quake/images/maps/');
20 $image_url->append ($db->f ("image"));
21 $image_url->replace_extension ('jpg');
22 $image_href = $Page->resolve_file ($image_url->as_text ());
23
24 $thumb_url = new URL ('{data}quake/images/maps/');
25 $thumb_url->append ($db->f ("image") . '_tn');
26 $thumb_url->replace_extension ('jpg');
27 $thumb_src = $Page->resolve_file ($thumb_url->as_text ());
28 ?>
29 <h2 class="clear-right"><?php echo $db->f ("name"); ?></h2>
30 <p>
31 <a class="align-right" href="<?php echo $image_href; ?>"><img src="<?php echo $thumb_src; ?>" alt="<?php echo $db->f ('name'); ?>"></a>
32 </p>
33 <table class="basic columns left-labels">
34 <tr>
35 <th>Version</th>
36 <td>
37 <?php echo $db->f ("version"); ?>
38 </td>
39 </tr>
40 <tr>
41 <th>Size</th>
42 <td>
43 <?php
44 $size = $db->f ("size");
45 echo file_size_as_text($size * 1024);
46 ?>
47 </td>
48 </tr>
49 <tr>
50 <th>Released</th>
51 <td>
52 <?php
53 include_once ('webcore/sys/date_time.php');
54 $date = new DATE_TIME ($db->f ("date"), Date_time_iso);
55 $df = $date->formatter ();
56 $df->type = Date_time_format_date_only;
57 echo $date->format($df);
58 ?>
59 </td>
60 </tr>
61 </table>
62 <p><?php echo $db->f ("description"); ?></p>
63 <p class="button-content">
64 <?php
65 $file_name = $Page->resolve_file (join_paths ('{data}quake/files/maps/', $db->f ("file"), global_url_options ()));
66 if ($db->f ("has_details"))
67 {
68 ?>
69 <a class="button" href="<?php echo $file_name; ?>">Download</a>
70 <a class="button" href="map_info.php?<?php echo "map=" . $db->f ("map"); ?>">Details...</a>
71 <?php
72 }
73 else
74 {
75 ?>
76 <a class="button" href="<?php echo $file_name; ?>">Download</a>
77 <?php
78 }
79 ?>
80 </p>
81 <?php } ?>
82 </div>
83 </div>
84 <?php $Page->finish_display (); ?>
85
86
87