$config['cache_path'] = $cachePath; // load page-framework require_once $appPath . DIRECTORY_SEPARATOR . 'page.php'; $page = new Page($config); if ($page->checkUri()) { // is use cache, than check for cache if ($page->config['use_cache']) { if ($cached = $page->getCacheContentForUri()) { echo $cached; return; } } // load content $content = $page->loadContent(); // load layout (index) $layoutFile = $page->getLayoutFile(); // load template $templateFile = $page->getTemplateFile($content['template']); unset($content['template']); // merge layout and template $merged = $page->mergeLayoutAndTemplate($layoutFile, $templateFile); // recursivly replace partials $mergedWithPartialFiles = $page->mergePartials($merged); // replace components $mergedWithComponents = $page->renderComponents($mergedWithPartialFiles); // replace contents $mergedWithContent = $page->mergeContent($mergedWithComponents, $content); // replace contents $finally = $page->mergeSite($mergedWithContent); // make a cache file, if use_cache is on if ($page->config['use_cache']) {