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_comment.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_comment.php'));
30 ?>
31

Source for template: webcore/pages/view_comment.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_comment_at_id ($id);
31  
32   if (isset ($folder))
33   {
34     $entry_query = $folder->entry_query ();
35     $entry = $entry_query->object_for_comment_at_id ($id);
36  
37     if (isset ($entry))
38     {
39       $com_query = $entry->comment_query ();
40       $comment = $com_query->object_at_id ($id);
41     }
42   }
43  
44   if (isset ($comment) && isset ($entry) && $App->login->is_allowed (Privilege_set_comment, Privilege_view, $comment))
45   {
46     $App->set_referer ();
47     $App->set_search_text (read_var ('search_text'));
48  
49     $Page->title->add_object ($folder);
50     $Page->title->add_object ($entry);
51     $Page->title->subject = $comment->title_as_plain_text ();
52  
53     $Page->location->add_folder_link ($folder);
54     $Page->location->add_object_link ($entry);
55     $Page->location->add_object_text ($comment);
56  
57     $Page->start_display ();
58  
59     $class_name = $App->final_class_name ('COMMENT_LIST_RENDERER', 'webcore/gui/comment_renderer.php');
60     /** @var $com_renderer COMMENT_LIST_RENDERER */
61     $com_renderer = new $class_name ($com_query, $comment);
62  
63     $commands = $com_renderer->make_commands();
64     if ($commands->num_executable_commands() > 0)
65     {
66   ?>
67 <div class="top-box">
68   <div class="button-content">
69     <span class="field"><?php echo $com_renderer->size(); ?></span> Replies
70     <?php
71     $menu = $App->make_menu();
72     $menu->renderer->content_mode = Menu_show_as_buttons;
73     $menu->display ();
74     ?>
75   </div>
76 </div>
77   <?php
78   }
79   ?>
80   <div class="main-box">
81     <div class="grid-content">
82       <?php $com_renderer->display (); ?>
83     </div>
84   </div>
85   <?php
86     $Page->finish_display ();
87   }
88   else
89   {
90     $Page->raise_security_violation ('You are not allowed to view this comment.', $folder);
91   }
92 ?>