2 /********************************************************************
6 Copyright 2008-2009 Radosław Pietruszewski
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ********************************************************************/
23 class Pages
extends Controller
25 function __construct()
32 // wyciągamy segmenty URL-a (nazwa page'a) i mierzymi ich ilość
34 $page = URL
::$segments;
36 $segments = count($page);
38 // jeśli brak segmentów
46 // jeśli $page jest stringiem zamieniamy go na tablicę z jedną wartością
55 $page = implode('/', $page);
57 // sprawdzamy czy istnieje
59 $Pages = $this->load
->model('Pages');
61 $data = $Pages->getData($page);
63 if($data->num_rows() > 0)
65 $data = $data->to_obj();
71 $content = $data->content
;
73 // przetwarzamy pseudotagi
75 $content = ViewTags
::Process($content);
79 eval('?>' . $content . '<?php ');
88 private function e404($pageName = '')
90 setH1('Błąd 404 : Nie odnaleziono');
92 echo '<div class="box_e">Na <em>' . Config
::$siteName . '</em> nie ma strony "' . $pageName . '".</div>';