Example #1
0
 private function renderPage($sUrl)
 {
     // Build page object
     $oPage = new Page($sUrl, $this->sConfigFile);
     $oPage->build();
     // Get the theme
     $sTheme = $this->_oConfig->get('site', 'theme');
     $oTheme = new Theme($sTheme, $this->sConfigFile);
     // Add assets, blocks and config
     $oTheme->setPageConfig($oPage->getConfig());
     $oTheme->addBlocks($oPage->getBlocks());
     $oTheme->addAssets($oPage->getAssets());
     // Add page list for menus
     $sPath = $this->_oConfig->getPath('pages');
     $oFilesystem = new Filesystem();
     $aPageList = $oFilesystem->getAllPagesInDir($sPath, '', $this->sConfigFile);
     $oTheme->setSitemapInfo($this->determineUrl(), $aPageList, $oPage->getChildren());
     return $oTheme->renderPage();
 }
Example #2
0
 /**
  * @param Page $page
  */
 public function render(Page $page)
 {
     $this->config = $page->getConfig();
     $header = '<!DOCTYPE html>' . PHP_EOL;
     $header .= '<html >' . PHP_EOL;
     $header .= '<head lang = "en">' . PHP_EOL;
     $header .= '<meta charset = "UTF-8">' . PHP_EOL;
     $header .= '<meta name = "viewport" content = "initial-scale=1.0"/>' . PHP_EOL;
     $style_sheets = array_merge($this->config->getGlobalStyleSheets(), $page->getStyleSheets());
     foreach ($style_sheets as $style_sheet) {
         $header .= '<link href="' . $this->getStyleSheetPath($style_sheet) . '" type="text/css" rel="stylesheet">' . PHP_EOL;
     }
     $java_scripts = array_merge($this->config->getGlobalJavaScripts(), $page->getJavaScripts());
     foreach ($java_scripts as $java_script) {
         $header .= '<script src="' . $this->getJavaScriptPath($java_script) . '" type="text/JavaScript"></script>' . PHP_EOL;
     }
     $header .= '<title>' . $page->getTitle() . '</title>' . PHP_EOL;
     $header .= '</head>' . PHP_EOL;
     $header .= '<body>' . PHP_EOL;
     echo $header;
 }
Example #3
0
 private function getPageFromDir($sDir, $sUrl, $sGlobalConfigFile)
 {
     $sNewUrl = $sUrl . '/' . $sDir;
     $oPage = new Page($sNewUrl, $sGlobalConfigFile);
     $aConfig = $oPage->getConfig();
     if (is_array($aConfig)) {
         $aConfig = array_change_key_case($aConfig, CASE_LOWER);
     } else {
         $aConfig = array();
     }
     return array('name' => $sDir, 'url' => $sNewUrl, 'config' => $aConfig, 'children' => $oPage->getChildren());
 }
 public function debug()
 {
     $this->smarty->debugging = true;
     $this->smarty->testInstall();
     $getConfig = parent::getConfig();
     $this->smarty->debug_tpl = 'debug.tpl';
     $this->smarty->display('debug.tpl');
 }
Example #5
0
     * @inheritdoc
     *
     * @param array $config
     *
     * @return array
     */
    public function onConfig(array $config = [])
    {
        return ["cache" => 5, "widgets" => false];
    }
}
final class PageExtension implements Configurable, Extension
{
    use ConfigurableTrait;
    use ExtensionTrait;
    /**
     * @inheritdoc
     *
     * @param array $config
     *
     * @return array
     */
    public function onConfig(array $config = [])
    {
        return ["widgets" => true];
    }
}
$page = new Page();
$page->addExtension(PageExtension::class);
$page->getConfig();
// [ "cache" => 5, "widgets" => true ]