+function getoutput($blocks = [])
+{
+ $rep = [];
+ foreach ($blocks as $name => $html) {
+ $rep["[[$name]]"] = sprintf('<!--BLOCK:%s-->%s<!--/-->',
+ is_numeric($name) ? '' : "[[$name]]",
+ preg_replace('{<!--[^-]*-->}', '', $html)
+ );
+ }
+ return str_replace(array_keys($rep), array_values($rep), ob_get_clean());
+}
+
+# custom error handling
+
+define('DOCROOT', getcwd().'/');
+