35 lines
783 B
PHP
35 lines
783 B
PHP
|
<?php
|
||
|
/*****************************************************************************
|
||
|
* Template.php
|
||
|
* Contains key Template interface.
|
||
|
*
|
||
|
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
|
||
|
*****************************************************************************/
|
||
|
|
||
|
abstract class Template
|
||
|
{
|
||
|
protected $_subtemplates = array();
|
||
|
|
||
|
abstract public function html_main();
|
||
|
|
||
|
public function adopt(Template $template, $position = 'end')
|
||
|
{
|
||
|
// By default, we append it.
|
||
|
if ($position == 'end')
|
||
|
$this->_subtemplates[] = $template;
|
||
|
// We can also add it to the beginning of the list, though.
|
||
|
else
|
||
|
array_unshift($this->_subtemplates, $template);
|
||
|
}
|
||
|
|
||
|
public function clear()
|
||
|
{
|
||
|
$this->_subtemplates = [];
|
||
|
}
|
||
|
|
||
|
public function pass($id, $data)
|
||
|
{
|
||
|
$this->{$id} = $data;
|
||
|
}
|
||
|
}
|