コード例 #1
0
 public static function getFile($pageName, $file, $themable, $folder)
 {
     // Creating the empty resourcePath variable
     $filePath;
     // Creating the resource relative path
     $fileRelativePath = "/" . $pageName . "/" . $folder . "/" . $file;
     // If the page instance is themable and the current theme contains the resource
     if ($themable && file_exists(Paladin::getThemeLoader()->getFolder() . "/" . Paladin::getThemeLoader()->getCurrentTheme() . $fileRelativePath)) {
         // Setting the template path to the theme template path
         $filePath = Paladin::getThemeLoader()->getFolder() . "/" . Paladin::getThemeLoader()->getCurrentTheme() . $fileRelativePath;
     } else {
         // Setting the template path to the default path
         $filePath = Paladin::getPageLoader()->getFolder() . $fileRelativePath;
     }
     // Getting the current route
     $route = Paladin::getRouteLoader()->getCurrentRoute();
     // Returning the resource path from the root folder
     return $filePath;
 }
コード例 #2
0
 /**
  * Renders a page
  *
  * @param page
  *           The page relative path
  * @param pageInstance
  *           The page main class instance
  * @param args
  *           The arguments of the page
  */
 private function renderPage($pageInstance, $args)
 {
     // Sending the 'beforeDisplayed()' event to the page
     $pageInstance->beforeDisplayed();
     // Creating the template path
     $templatePath = "/" . $pageInstance->getName() . "/" . $pageInstance->getMainPage();
     // If the page instance is themable and the current theme contains the page
     if ($pageInstance->isThemable() && file_exists(Paladin::getThemeLoader()->getFolder() . "/" . Paladin::getThemeLoader()->getCurrentTheme() . $templatePath)) {
         // Setting the template path to the theme template path
         $templatePath = Paladin::getThemeLoader()->getFolder() . "/" . Paladin::getThemeLoader()->getCurrentTheme() . $templatePath;
     } else {
         // Setting the template path to the default path
         $templatePath = $this->folder . $templatePath;
     }
     // Rendering the page with Twig
     echo Paladin::getTwig()->render($templatePath, $pageInstance->constructTwigArray($args));
     // Sending the 'afterDisplayed()' event to the page
     $pageInstance->afterDisplayed();
 }