<?php

$FLUID_CACHE_DIRECTORY = !isset($FLUID_CACHE_DIRECTORY) ? __DIR__ . '/../cache/' : $FLUID_CACHE_DIRECTORY;
// Use Composer's autoloader to handle our class loading.
require_once __DIR__ . '/../vendor/autoload.php';
$templatePaths = new \TYPO3Fluid\Fluid\View\TemplatePaths();
$templatePaths->setTemplateRootPaths(array(__DIR__ . '/../Resources/Private/Templates/'));
$templatePaths->setLayoutRootPaths(array(__DIR__ . '/../Resources/Private/Layouts/'));
$templatePaths->setPartialRootPaths(array(__DIR__ . '/../Resources/Private/Partials/'));
$view = new \TYPO3Fluid\Fluid\View\TemplateView($templatePaths);
if ($FLUID_CACHE_DIRECTORY) {
    $view->setCache(new \TYPO3Fluid\Fluid\Core\Cache\SimpleFileCache($FLUID_CACHE_DIRECTORY));
}
$view->getRenderingContext()->setControllerName('Page');
try {
    if (array_key_exists('PATH_INFO', $_SERVER)) {
        $path = substr($_SERVER['PATH_INFO'], 1);
        if ($path === FALSE) {
            $path = 'index';
        }
    } else {
        $path = 'index';
    }
    $output = $view->render($path);
} catch (\Exception $exception) {
    $output = $view->render('error');
}
echo $output;