//building the right path to required template $templpath = $GLOBALS['templatepath'] . $settings['template'] . "/index.html"; //copies template into variable $connect = @fopen($templpath, "rb") or die("Unfortunately I could not find a valid template!"); $template = fread($connect, 262144); fclose($connect); //includes official loudblog-tags include "loudblog/inc/loudblogtags.php"; //includes plugins from plugins-folder $folder = opendir('loudblog/custom/plugins'); while ($file = readdir($folder)) { if (substr($file, -4, 4) == ".php") { include "loudblog/custom/plugins/" . $file; } } echo fullparse(hrefmagic($template)); //-------------------------------------------------------- function fullparse($string) { //first we have to look for container-tags and parse them. $contparsed = parsecontainer($string); //now we put the container-parsing-results into the original string if (isset($contparsed[0]) and $contparsed[0] != false) { foreach ($contparsed as $replace) { $string = str_replace($replace['origin'], $replace['parsed'], $string); } } //secondly, we have to look for single-tags and parse them, too. $singleparsed = parsesingle($string); //now we put the single-parsing-results into the original template if (isset($singleparsed[0])) {
<?php // This is the second slowliest and second ugliest parsing method ever. Please do not take a closer look. Loudblog will be rewritten soon with an elegant and fast parsing method. Until then, you will have to use this one. I'm sorry. //start parsing! $parsedpage = fullparse(firstparse(hrefmagic($template))); //do we have php code within our template? switch between echo and eval! if ($php_use) { $templatepieces = explode($phpseparator, $parsedpage); for ($i = 0; $i <= count($templatepieces); $i += 2) { echo $templatepieces[$i]; if (isset($templatepieces[$i + 1])) { eval($templatepieces[$i + 1]); } } //no php code, no eval! } else { echo $parsedpage; } //-------------------------------------------------------- function firstparse($string) { //very first, we do the loop_postings, because we need some global data for other functions, aight? $postparsed = parsepostings($string); //now we put the posting-parsing-results into the original string if (isset($postparsed[0]) and $postparsed[0] != false) { foreach ($postparsed as $replace) { $string = str_replace($replace['origin'], $replace['parsed'], $string); } } return $string; }