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 require_once ('webcore/init.php');
02
03 define ('Current_poll_id', 7);
04 define ('Show_latest_pictures', true);
05 define ('Num_picture_columns', 5);
06 define ('Num_picture_rows', 1);
07 define ('Max_picture_width', 100);
08 define ('Max_picture_height', 75);
09 $Themes_to_show = array (16, 33, 10, 32, 20, 1);
10
11 include_once ('news/init.php');
12 $news_app = $Page->make_application (News_application_id);
13
14 $apps_url = $Page->resolve_path('{apps}');
15 $browser_url = $Page->resolve_file($Page->template_options->browser_url);
16 $settings_url = $Page->resolve_file($Page->template_options->settings_url);
17
18 /* Make this the last page for this application. A login will return here. */
19
20 $news_app->set_referer ();
21
22 /* Make the application's login info appear in the header. It's the
23 main application for the page, but set in this way so that it doesn't
24 override the banner icon and other settings. */
25 $Page->app = $news_app;
26
27 $Page->start_display ();
28
29 $browser = $Env->browser ();
30 if ($browser->supports (Browser_CSS_2))
31 {
32 $width_style = 'min-width: 35em';
33 }
34 else
35 {
36 $width_style = 'width: 700px';
37 }
38
39 define ("Webcore_project_id", 6);
40 require_once ('projects/init.php');
41 $projects_app = $Page->make_application (Project_application_id);
42 require_once ('projects/util/project_version_formatter.php');
43 $release_data = new PROJECT_VERSION_FORMATTER($projects_app, Webcore_project_id);
44 ?>
45 <div style="<?php echo $width_style; ?>">
46 <div class="colmask leftmenu" id="main-area">
47 <div class="colleft">
48 <div class="col1">
49 <!-- Column 1 start -->
50 <div class="box" style="margin-left: 40px">
51 <div class="box-body" style="padding-top: 0px">
52 <p style="margin-top: 0px">This is a personal web site, run by <a href="users/marco" title="Marco Von Ballmoos" style="cursor: help">Marco</a> (of <a href="http://encodo.com/" title="Encodo Systems AG - Web Sites Made Simple" style="cursor: help">Encodo Systems AG</a>), that caters to
53 a small community of users. Its exclusivity is almost guaranteed by its obscurity.</p>
54 <hr>
55 <div style="width: 100%; float: left; background: url(<?php echo $Page->sized_icon ('{site_icons}products/albums', '50px'); ?>) no-repeat 0px 0px; min-height: 50px">
56 <h1 style="margin-top: 10px">
57 <a style="padding: 0px 5px 0px 60px" href="<?php echo $apps_url; ?>albums/">Albums</a><?php
58 $newsfeed_options = clone($Page->newsfeed_options); // Do not change the main options
59 $newsfeed_options->title->subject = 'earthli Albums';
60 $newsfeed_options->file_name = 'albums/index_rss.php';
61
62 $newsfeed_commands = $newsfeed_options->make_commands($Page);
63 $renderer = $Page->make_newsfeed_menu_renderer ();
64 $renderer->alignment = Menu_align_inline;
65 $renderer->display ($newsfeed_commands);
66 ?>
67 </h1>
68 <div style="padding-left: 10px; ">
69 <?php
70 if (Show_latest_pictures)
71 {
72 ?>
73 <p>Check out the
74 <a href="albums/?panel=picture&time_frame=recent">latest pictures</a> below.</p>
75 <?php
76 include_once ('albums/init.php');
77 $albums_app = $Page->make_application (Album_application_id);
78
79 $entry_query = $albums_app->login->all_entry_query ();
80 $entry_query->set_type ('picture');
81 $entry_query->set_filter (Visible);
82 $entry_query->set_order ('time_created DESC');
83
84 $class_name = $albums_app->final_class_name ('TINY_PICTURE_GRID', 'albums/gui/tiny_picture_grid.php');
85 $grid = new $class_name ($albums_app);
86 $grid->set_ranges (Num_picture_rows, Num_picture_columns);
87 $grid->show_paginator = false;
88 $grid->max_width = Max_picture_width;
89 $grid->max_height = Max_picture_height;
90 $grid->set_query ($entry_query);
91 $grid->display ();
92 }
93 ?>
94 </div>
95 </div>
96 <div style="margin-top: 20px; width: 100%; float: left; background: url(<?php echo $Page->sized_icon ('{site_icons}products/news', '50px'); ?>) no-repeat 0px 0px; min-height: 50px">
97 <h1 style="margin-top: 13px">
98 <a style="padding: 0px 5px 0px 60px" href="<?php echo $apps_url; ?>news/">News</a><?php
99 $newsfeed_options = clone($Page->newsfeed_options); // Do not change the main options
100 $newsfeed_options->title->subject = 'earthli News';
101 $newsfeed_options->file_name = 'news/index_rss.php';
102
103 $newsfeed_commands = $newsfeed_options->make_commands($Page);
104 $renderer = $Page->make_newsfeed_menu_renderer ();
105 $renderer->alignment = Menu_align_inline;
106 $renderer->display ($newsfeed_commands);
107 ?>
108 </h1>
109 <div>
110 <?php
111 $entry_query = $news_app->login->all_entry_query ();
112 /* Removed the restriction to only earthli site news. Without the
113 restriction, all articles in earthli News are shown.
114
115 $entry_query->restrict_by_op ('folder_id', array (16, 26), Operator_in);
116 */
117 $entry_query->set_filter (Visible);
118 $entry_query->set_limits(0, 7);
119
120 $objs = $entry_query->objects();
121
122 if (!empty($objs))
123 {
124 echo '<ul style="margin: 0px; padding: 0px; margin-left: 0px">';
125 foreach ($objs as $obj)
126 {
127 $t = $obj->title_formatter ();
128 $t->CSS_class = '';
129 $t->max_visible_output_chars = 35;
130
131 $fldr = $obj->parent_folder();
132 $ft = $fldr->title_formatter ();
133 $ft->CSS_class = '';
134 $ft->max_visible_output_chars = 0;
135
136 $fd = $obj->time_published->formatter ();
137 $fd->type = Date_time_format_short_date;
138
139 echo '<li style="list-style-type: none; margin: 0px; padding: 2px 0px">';
140 echo '<span style="float: left">';
141 echo $obj->title_as_link($t);
142 echo "</span>";
143 echo '<span style="float: right; margin-left: 10px">';
144 echo $obj->time_published->format ($fd);
145 echo '</span>';
146 echo '<span style="float: right">';
147 echo $fldr->title_as_link($ft);
148 echo '</span>';
149 echo '<span style="clear: both; display: block"></span></li>';
150 }
151 echo "</ul>";
152 }
153 ?>
154 </div>
155 </div>
156 <div style="margin-top: 20px; width: 100%; float: left; background: url(<?php echo $Page->sized_icon ('{site_icons}products/recipes', '50px'); ?>) no-repeat 0px 0px; min-height: 50px">
157 <h1 style="margin-top: 17px">
158 <a style="padding: 0px 5px 0px 60px" href="<?php echo $apps_url; ?>recipes/">Recipes</a><?php
159 $newsfeed_options = clone($Page->newsfeed_options); // Do not change the main options
160 $newsfeed_options->title->subject = 'earthli Recipes';
161 $newsfeed_options->file_name = 'recipes/index_rss.php';
162
163 $newsfeed_commands = $newsfeed_options->make_commands($Page);
164 $renderer = $Page->make_newsfeed_menu_renderer ();
165 $renderer->alignment = Menu_align_inline;
166 $renderer->display ($newsfeed_commands);
167 ?>
168 </h1>
169 <div>
170 <?php
171 include_once ('recipes/init.php');
172 $recipes_app = $Page->make_application (Recipe_application_id);
173 $entry_query = $recipes_app->login->all_entry_query ();
174 $entry_query->set_filter (Visible);
175 $entry_query->set_limits(0, 5);
176
177 $objs = $entry_query->objects();
178
179 if (!empty($objs))
180 {
181 echo '<ul style="margin: 0px; padding: 0px; margin-left: 0px">';
182 foreach ($objs as $obj)
183 {
184 $t = $obj->title_formatter ();
185 $t->CSS_class = '';
186 $t->max_visible_output_chars = 35;
187
188 $fldr = $obj->parent_folder();
189 $ft = $fldr->title_formatter ();
190 $ft->CSS_class = '';
191 $ft->max_visible_output_chars = 0;
192
193 $fd = $obj->time_published->formatter ();
194 $fd->type = Date_time_format_short_date;
195
196 echo '<li style="list-style-type: none; margin: 0px; padding: 2px 0px">';
197 echo '<span style="float: left">';
198 echo $obj->title_as_link($t);
199 echo "</span>";
200 echo '<span style="float: right; margin-left: 10px">';
201 echo $obj->time_published->format ($fd);
202 echo '</span>';
203 echo '<span style="float: right">';
204 echo $fldr->title_as_link($ft);
205 echo '</span>';
206 echo '<span style="clear: both; display: block"></span></li>';
207 }
208 echo "</ul>";
209 }
210 ?>
211 </div>
212 </div>
213 <div style="margin-top: 20px; width: 100%; float: left; background: url(<?php echo $Page->sized_icon ('{site_icons}products/projects', '50px'); ?>) no-repeat 0px 0px; min-height: 50px">
214 <h1 style="margin-top: 12px">
215 <a style="padding: 0px 5px 0px 60px" href="<?php echo $apps_url; ?>projects/">Projects</a><?php
216 $newsfeed_options = clone($Page->newsfeed_options); // Do not change the main options
217 $newsfeed_options->title->subject = 'earthli Projects';
218 $newsfeed_options->file_name = 'projects/index_rss.php';
219
220 $newsfeed_commands = $newsfeed_options->make_commands($Page);
221 $renderer = $Page->make_newsfeed_menu_renderer ();
222 $renderer->alignment = Menu_align_inline;
223 $renderer->display ($newsfeed_commands);
224 ?>
225 </h1>
226 <div>
227 <?php
228 $entry_query = $projects_app->login->all_entry_query ();
229 $entry_query->set_type ('job');
230 $entry_query->set_filter (Visible);
231 $entry_query->set_limits(0, 5);
232 $entry_query->restrict ("closer_id <> 0");
233 $entry_query->set_order ('time_closed DESC');
234 $entry_query->store_order_as_recent ();
235
236 $objs = $entry_query->objects();
237
238 if (!empty($objs))
239 {
240 echo '<ul style="margin: 0px; padding: 0px; margin-left: 0px">';
241 foreach ($objs as $obj)
242 {
243 $t = $obj->title_formatter ();
244 $t->CSS_class = '';
245 $t->max_visible_output_chars = 50;
246
247 $fldr = $obj->parent_folder();
248 $ft = $fldr->title_formatter ();
249 $ft->CSS_class = '';
250 $ft->max_visible_output_chars = 0;
251
252 $branch_info = $obj->main_branch_info();
253
254 $fd = $branch_info->time_closed->formatter ();
255 $fd->type = Date_time_format_short_date;
256
257 echo '<li style="list-style-type: none; margin: 0px; padding: 2px 0px">';
258 echo '<span style="float: left">';
259 echo $obj->kind_icon () . ' ' . $obj->title_as_link($t);
260 echo "</span>";
261 echo '<span style="float: right; margin-left: 10px">';
262 echo $branch_info->time_closed->format ($fd);
263 echo '</span>';
264 echo '<span style="float: right">';
265 echo $fldr->title_as_link($ft);
266 echo '</span>';
267 echo '<span style="clear: both; display: block"></span></li>';
268 }
269 echo "</ul>";
270 }
271 ?>
272 </div>
273 </div>
274 <div style="clear: both; display: block"></div>
275 <hr>
276 <p>There are other, less frequented, but nonetheless interesting areas. Some are
277 part of history; some are still updated.</p>
278 <div style="margin: auto; display: table">
279 <div style="float: left; margin: 1em .5em">
280 <a href="software/"><?php echo $Page->resolve_icon_as_html ('{site_icons}products/software', 'Software', '32px'); ?></a>
281 </div>
282 <div style="float: left; margin: 1em .5em">
283 <a href="hochzeit/"><?php echo $Page->resolve_icon_as_html ('{site_icons}products/hochzeit', 'Hochzeit', '32px'); ?></a>
284 </div>
285 <div style="float: left; margin: 1em .5em">
286 <a href="jass/"><?php echo $Page->resolve_icon_as_html ('{site_icons}products/jass', 'Jass', '32px'); ?></a>
287 </div>
288 <div style="float: left; margin: 1em .5em">
289 <a href="quake/"><?php echo $Page->resolve_icon_as_html ('{site_icons}products/quake', 'Quake III', '32px'); ?></a>
290 </div>
291 <div style="float: left; margin: 1em .5em">
292 <a href="jkd/"><?php echo $Page->resolve_icon_as_html ('{site_icons}products/jkd', 'Jeet Kune Do', '32px'); ?></a>
293 </div>
294 <div style="float: left; margin: 1em .5em">
295 <a href="systems/"><?php echo $Page->resolve_icon_as_html ('{site_icons}products/systems', 'earthli Systems', '32px'); ?></a>
296 </div>
297 <div style="float: left; margin: 1em .5em">
298 <a href="webcam/"><?php echo $Page->resolve_icon_as_html ('{site_icons}products/webcam', 'WebCam', '32px'); ?></a>
299 </div>
300 </div>
301 <div>
302 <p>And, finally, visit our mascot's home page. His name's <a href="users/oz">Oz</a> and
303 he moved from New York City to Switzerland with us. He was one of our most frequent
304 updaters until we parted ways in August of 2004.</p>
305 <p style="text-align: center">
306 <a href="users/oz/" style="cursor: help"><?php echo $Page->resolve_icon_as_html ('{site_icons}products/earthli_rabbit_logo', 'The Oz-man', '50px'); ?></a>
307 </p>
308 </div>
309 </div>
310 <div style="clear: both">
311 <!-- Main content must be longer for IE, else floats aren't fully rendered -->
312 </div>
313 </div>
314 <!-- Column 1 end -->
315 </div>
316
317 <div class="col2">
318 <!-- Column 2 start -->
319 <div class="side-bar">
320 <div class="side-bar-body">
321 <div class="notes" style="text-align: center">
322 <p>This site is built with the <a href="software/webcore/">earthli WebCore</a>.
323 Click the box to learn more!</p>
324 <p><a href="software/webcore/"><img src="software/webcore/media/images/webcore_box_green_small.png" alt="WebCore Box"></a></p>
325 <p>Version <span class="field"><?php echo $release_data->version; ?></span><br>
326 was released on<br>
327 <span class="field"><?php echo $release_data->release_date; ?></span><br>
328 (<a href="<?php echo $release_data->change_log_link; ?>">Release Notes</a>)</p>
329 </div>
330 </div>
331 </div>
332 <div class="side-bar">
333 <div class="side-bar-title">Theme</div>
334 <div class="side-bar-body">
335 <div class="notes" style="margin-bottom: 1em">Choose the theme that best suits you.</div>
336 <?php
337 $theme_query = $Page->theme_query ();
338 $theme_query->restrict_by_op ('id', $Themes_to_show, Operator_in);
339
340 $class_name = $Page->final_class_name ('THEME_SELECTOR_GRID', 'webcore/gui/theme_selector_grid.php');
341 $grid = new $class_name ($Page);
342 $grid->set_ranges (sizeof ($Themes_to_show), 1);
343 $grid->show_paginator = false;
344 $grid->set_query ($theme_query);
345 $grid->display ();
346 ?>
347 <p class="detail" style="text-align: right">[<a href="<?php echo $settings_url; ?>">More</a>]</p>
348 </div>
349 </div>
350 <div class="side-bar">
351 <div class="side-bar-title">Poll</div>
352 <div class="side-bar-body">
353 <?php
354 require_once ('plugins/com.earthli.polls.init.php');
355
356 $poll_app = make_poll_application ($Page);
357 $poll_query = $poll_app->poll_query ();
358 $poll = $poll_query->object_at_id (Current_poll_id);
359 if ($poll->can_vote ())
360 {
361 $form = $poll->form ();
362 $renderer = $form->make_renderer ();
363 $renderer->set_width ('12em');
364 $form->display ($renderer);
365 }
366 else
367 {
368 $poll->display_results ();
369 }
370 ?>
371 <?php if ($poll->closed) { ?>
372 <p>Poll is closed</p>
373 <?php } ?>
374 <div style="text-align: center">
375 <?php
376 $menu = new MENU ($Page);
377 $menu->append ('archives', $Page->resolve_path ('{root}polls/'));
378 if (! $poll->voted)
379 {
380 $menu->append ('results', $Page->resolve_file ("{root}polls/index.php?id=$poll->id"));
381 }
382
383 $menu->display ();
384 ?>
385 </div>
386 </div>
387 </div>
388 <div class="detail" style="text-align: center">
389 <p>Proud to be a standards-compliant web site.</p>
390 <?php $path_to_powered_by = $Page->resolve_path ('{root}/common/images/powered_by/'); ?>
391 <p>
392 <a href="http://validator.w3.org/check/referer"><img src="<?php echo $path_to_powered_by; ?>valid-html401.png" alt="Valid HTML 4.01! (Strict)"></a>
393 </p>
394 <p>Find out more about <a href="<?php echo $browser_url; ?>">your browser</a>.</p>
395 </div>
396 <!-- Column 2 end -->
397 </div>
398
399 <div class="col3">
400 <!-- Column 3 start -->
401 <!-- Column 3 end -->
402 </div>
403 </div>
404 </div>
405 </div>
406 <?php $Page->finish_display (); ?>
407