getPageData (); $html = $page->getTemplate (); unset ($page); $path = new Crumbpath ($pageKey, PLUGIN_ID); $crumbPath = $path->get(); unset ($path); // eerst mergen van objecten benoemd in de template zelf preg_match_all ('/\{(OBJ::)([A-Z0-9_]+)\}/i', $html, $templateParts, PREG_SET_ORDER); foreach ($templateParts as $classData) { $className = end ($classData); if (file_exists (CLASSES_PATH . 'cls_' . strtolower ($className) . '.php')) { include_once (CLASSES_PATH . 'cls_' . strtolower ($className) . '.php'); $obj = new $className ('', $pageKey, PLUGIN_ID, $pageData, $crumbPath); $html = str_replace ('{OBJ::' . strtoupper ($className) . '}', $obj->get(), $html); unset ($obj); // ruim object op } } // vervolgens mergen op basis van overeenkomstige nodes uit contenttype van current pagina preg_match_all ('/\{([A-Z0-9_]+)\}/i', $html, $templateParts, PREG_SET_ORDER); foreach ($templateParts as $nodeData) { $node = strtolower (end ($nodeData)); $ctXml = simplexml_load_string ($pageData['cot_definition']); $ctNode = reset ($ctXml->xpath ($node)); $attr = $ctNode->attributes(); switch ($attr['type']) { case 'object': if (file_exists (CLASSES_PATH . 'cls_' . strtolower ($className) . '.php')) { $className = strval ($attr['class']); include_once (CLASSES_PATH . 'cls_' . strtolower ($className) . '.php'); $obj = new $className ('', $pageKey, PLUGIN_ID, $pageData, $crumbPath); $html = str_replace ('{' . strtoupper ($node) . '}', $obj->get(), $html); unset ($obj); // ruim object op } break; case 'script': $output = ''; if (file_exists (SCRIPTS_PATH . strval ($attr['name']) . '.php')) { include_once (SCRIPTS_PATH . strval ($attr['name']) . '.php'); $html = str_replace ('{' . strtoupper ($node) . '}', $output, $html); unset ($output); } break; case 'form': include_once (CLASSES_PATH . 'cls_webform.php'); $form = new Webform ('', $pageKey, PLUGIN_ID, $pageData, $crumbPath); if ($form->getFormDefinition ($node)) { if (isset ($_POST['sendRenderedForm'])) { if ($form->validateForm()) { $form->saveForm(); } } $html = str_replace ('{' . strtoupper ($node) . '}', $form->renderForm(), $html); } unset ($form); // ruim object op break; default: // tekst, richtekst etc $html = str_replace ('{' . strtoupper ($node) . '}', getNodeData ($pageData['wep_content'], $node), $html); break; } //echo $attr['type'] . '
'; //die(); } $html = preg_replace ('/\{.+\}/', '', $html); die ($html); ?>