Example #1
0
 /**
  * Execute the request
  *
  * @return void
  */
 public function execute()
 {
     $request = new Request();
     $uri = $request->getRequestedFile();
     // Special option to clear cache for this file with ?cache=clear
     if ($request->cache == 'clear') {
         $this->getCache()->clear($uri);
     }
     $this->getCache()->start($uri);
     $sitemap = new Sitemap($this->getContentDir(), $request->getBaseUrl());
     $location = $sitemap->getLocationForUrl($uri);
     // If canonical is set, we should redirect thither instead.
     if ($location->getCanonical()) {
         $this->redirect($request->getBaseUrl('/') . $location->getCanonical());
     }
     $theme = $this->makeTheme($request);
     $view = new View($theme);
     $view->setContentDir($this->getContentDir());
     $view->setParams($this->getConfig());
     $this->setupNavigationItems($request, $uri, $view);
     echo $view->renderContentFile($location);
     $this->getCache()->end();
 }