Commit | Line | Data |
---|---|---|
2aa91ff2 S |
1 | <?php |
2 | namespace dns\page; | |
3 | use dns\system\DNS; | |
4 | ||
5 | /** | |
6 | * @author Jan Altensen (Stricted) | |
7 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | |
d4779364 | 8 | * @copyright 2014-2016 Jan Altensen (Stricted) |
2aa91ff2 S |
9 | */ |
10 | abstract class AbstractPage { | |
11 | public $activeMenuItem = ''; | |
12 | public $template = ""; | |
13 | ||
14 | public final function __construct() { | |
15 | $this->prepare(); | |
16 | $this->show(); | |
17 | } | |
18 | ||
19 | abstract public function prepare(); | |
20 | ||
21 | public final function show() { | |
22 | if (empty($this->template) || $this->template == "") { | |
23 | $classParts = explode('\\', get_class($this)); | |
24 | $className = str_replace('Page', '', array_pop($classParts)); | |
25 | $this->template = lcfirst($className).".tpl"; | |
26 | } | |
27 | else { | |
28 | if (substr($this->template, -4) != ".tpl") { | |
29 | $this->template = $this->template.".tpl"; | |
30 | } | |
31 | } | |
32 | ||
33 | DNS::getTPL()->assign(array("activeMenuItem" => $this->activeMenuItem)); | |
34 | DNS::getTPL()->display($this->template); | |
35 | } | |
36 | } |