Esempio n. 1
0
 public function testLoader()
 {
     $themeLoader = new XmlThemeLoader();
     $theme = $themeLoader->load(__DIR__ . '/../themes/demo/theme.xml');
     $this->assertEquals($theme->getName(), 'Demo');
     $siteLoader = new XmlSiteLoader();
     $site = $siteLoader->load(__DIR__ . '/../sites/demo/site.xml');
     $renderer = new Renderer();
     $html = $renderer->renderSitePage($theme, $site, 'home', 'en');
     echo $html;
 }
Esempio n. 2
0
 private function initializeDomain()
 {
     $host = $_SERVER['HTTP_HOST'];
     $part = explode(':', $host);
     $domain = $part[0];
     $domainConfigFile = __DIR__ . '/../app/config/domains/' . $domain . '.yml';
     if (!file_exists($domainConfigFile)) {
         throw new RuntimeException("Domain not configured: {$domain}");
     }
     $parser = new YamlParser();
     $domainConfig = $parser->parse(file_get_contents($domainConfigFile));
     // Load the theme
     $themeLoader = new XmlThemeLoader();
     $themePath = $domainConfig['theme']['path'];
     $this->theme = $themeLoader->load($themePath . '/theme.xml');
     // Load the site
     $siteLoader = new XmlSiteLoader();
     $sitePath = $domainConfig['site']['path'];
     $this->site = $siteLoader->load($sitePath . '/site.xml');
 }