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.
Source for: https://www.earthli.com/news/view_entry_source.php
Uses WebCore template(s):
00 <?php
01
02 /****************************************************************************
03
04 Copyright (c) 2002-2014 Marco Von Ballmoos
05
06 This file is part of earthli News.
07
08 earthli News is free software; you can redistribute it and/or modify
09 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 earthli News is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with earthli News; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 For more information about the earthli News, visit:
23
24 http://www.earthli.com/software/webcore/news
25
26 ****************************************************************************/
27
28 require_once ('news/start.php');
29 require_once ($App->page_template_for ('webcore/pages/view_entry_source.php'));
30 ?>
31
Source for template: webcore/pages/view_entry_source.php
00 <?php
01
02 /****************************************************************************
03
04 Copyright (c) 2002-2014 Marco Von Ballmoos
05
06 This file is part of earthli WebCore.
07
08 earthli WebCore is free software; you can redistribute it and/or modify
09 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 earthli WebCore is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with earthli WebCore; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 For more information about the earthli WebCore, visit:
23
24 http://www.earthli.com/software/webcore
25
26 ****************************************************************************/
27
28 $id = read_var ('id');
29 $folder_query = $App->login->folder_query ();
30 $folder = $folder_query->folder_for_entry_at_id ($id);
31
32 if (isset ($folder))
33 {
34 $entry_query = $folder->entry_query ();
35
36 /* Set this global value to optimize the query for accessing the particular
37 type of entry. */
38 if (isset ($entry_type_id))
39 {
40 $entry_query->set_type ($entry_type_id);
41 }
42
43 $entry = $entry_query->object_at_id ($id);
44 }
45
46 if (isset ($entry) && $App->login->is_allowed (Privilege_set_entry, Privilege_view, $entry))
47 {
48 $App->set_referer ();
49 $App->set_search_text (read_var ('search_text'));
50
51 $entry_info = $entry->type_info ();
52
53 $location_renderer = $entry->handler_for (Handler_location);
54 $location_renderer->add_to_page_as_link ($Page, $entry);
55
56 $Page->location->append('Source', '', '{icons}buttons/source');
57
58 $Page->add_style_sheet ($Env->logger_style_sheet);
59
60 $navigator = $entry->handler_for (Handler_navigator);
61 $navigator->set_query ($entry_query);
62 $navigator->set_selected ($id);
63
64 $Page->start_display ();
65 ?>
66 <div class="main-box">
67 <p>This page shows the source for this entry, with <a href="text_formatting.php">WebCore formatting language</a> tags and attributes highlighted.</p>
68 <?php
69 /** @var ENTRY_RENDERER $renderer */
70 $renderer = $entry->handler_for (Handler_source_renderer);
71 $options = $renderer->options();
72 $options->load_from_request();
73 $renderer->display ($entry);
74 ?>
75 </div>
76 <?php
77 $Page->finish_display ();
78 }
79 else
80 {
81 $Page->raise_security_violation ("You are not allowed to view this item.", $folder);
82 }
83 ?>