public function render_template() { $template = SystemTemplate::get(Router::$node->getProperty('template')); if (null === $template) { $template = SystemTemplate::get(Config::get('DEFAULT_TEMPLATE')); } $html = $template->getPHP(); $tokens = TreeScript::getParse($html); $text = ''; foreach ($tokens as $i => $token) { if ($token['type'] == 'tag' && $token['name'] == 'BODY') { $text .= $this->html; } else { $this->tokenDefault($token, $text); } } $this->html = $text; $this->css .= $template->getCSS(); $this->appendJS($template->getJS()); }
<?php $id = $_POST['id_template']; $code = $_POST['html']; SystemTemplate::get($id)->setPHP($code);
<?php $id = $_POST['id_template']; $code = $_POST['js']; SystemTemplate::get($id)->setJS($code);
<?php $id = $_POST['id_template']; $template = SystemTemplate::get($id); $result = array('html' => $template->getPHP(), 'css' => $template->getCSS(), 'js' => $template->getJS()); echo json_encode($result);