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('hochzeit/init.php');
02  
03 $panel = read_var('panel', 'intro');
04  
05 if ($panel [strlen($panel) - 1] == '>')
06 {
07   // bad email link
08   $panel = substr($panel, 0, strlen($panel) - 1);
09 }
10  
11 $Page->location->append('Hochzeit');
12  
13 $Page->start_display();
14  
15 $class_name = $Page->final_class_name('INVITEE_QUERY', 'hochzeit/db/invitee_query.php');
16 /** @var INVITEE_QUERY $query */
17 $query = new $class_name ($Page);
18  
19 $query->restrict('reception = 1');
20 $reception_attendance = $query->size();
21 $query->clear_restrictions();
22  
23 $query->restrict('picnic = 1');
24 $picnic_attendance = $query->size();
25 $query->clear_restrictions();
26  
27 $query->restrict('((picnic <> 0) OR (reception <> 0))');
28 $num_rsvps = $query->size();
29 $query->clear_restrictions();
30  
31 $db = $Page->database;
32 $db->query('SELECT SUM(picnic_guests) FROM marco.hochzeit_guests WHERE picnic = 1');
33 if ($db->next_record())
34 {
35   /** @var integer $guest_count */
36   $guest_count = $db->f(0);
37  
38   $picnic_attendance += $guest_count;
39 }
40  
41 $num_objects = $query->size();
42  
43 $picnic_estimate = $num_rsvps > 0 ? floor(($num_objects * $picnic_attendance) / $num_rsvps) : 0;
44 $reception_estimate = $num_rsvps > 0 ? floor(($num_objects * $reception_attendance) / $num_rsvps) : 0;
45  
46 $today = time();
47 $deadline = mktime(23, 59, 59, 8, 23, 2002);
48  
49 $days_left = max(0, ceil(($deadline - $today) / 86400));
50 ?>
51 <div class="main-box">
52   <div class="columns">
53     <div class="text-flow">
54       <?php
55       include("hochzeit/pages/$panel.php");
56       ?>
57     </div>
58     <div class="right-sidebar tree-content">
59       <div class="toc">
60         <ol>
61           <li><a href="index.php">Home</a></li>
62           <li><a href="index.php?panel=calendar">Calendar</a></li>
63           <li><a href="index.php?panel=rsvp">R.S.V.P.</a>
64             <ol>
65               <li><a href="index.php?panel=guest_list">Guest List</a></li>
66               <li><a href="index.php?panel=guest_search">Guest Search</a></li>
67             </ol>
68           </li>
69           <li><a href="index.php?panel=reception">Reception</a>
70             <ol>
71               <li><a href="index.php?panel=table_layout">Table Layout</a></li>
72             </ol>
73           </li>
74           <li><a href="index.php?panel=picnic">Picnic</a></li>
75           <li><a href="index.php?panel=accommodations">Accommodations</a></li>
76           <li><a href="index.php?panel=invitation">Documents</a></li>
77           <li><a href="index.php?panel=gifts">Gift Policy</a></li>
78         </ol>
79       </div>
80       <div class="text-flow">
81         <h2>Statistics</h2>
82         <p><a class="field" href="index.php?panel=guest_list"><?php echo $num_objects; ?></a> guests invited</p>
83         <p><span class="field"><?php echo $num_rsvps; ?></span> responded</p>
84         <p><a class="field"
85               href="index.php?panel=guest_list&amp;reception=1&amp;sort_by_date=1"><?php echo $reception_attendance; ?></a> coming to reception
86         </p>
87         <?php if ($days_left > 0)
88         { ?>
89           <p class="notes">(<?php echo $reception_estimate; ?> projected)</p>
90         <?php } ?>
91         <p><a class="field"
92               href="index.php?panel=guest_list&amp;picnic=1&amp;sort_by_date=1"><?php echo $picnic_attendance; ?></a> coming to picnic
93         </p>
94         <?php if ($days_left > 0)
95         { ?>
96           <p class="notes">(<?php echo $picnic_estimate; ?> projected)</p>
97         <?php } ?>
98         <?php
99         $message = '<span class="field">' . $days_left . '</span> days left to R.S.V.P.';
100         if ($days_left <= 7)
101         {
102           $Page->show_message($message);
103         }
104         else
105         {
106           echo '<p>' . $message . '</p>';
107         }
108         ?>
109       </div>
110     </div>
111   </div>
112 </div>
113 <?php $Page->finish_display(); ?>
114