Пример #1
0
 function GET()
 {
     $cache = $this->registry->get('cache');
     if ($data = $cache->get('cms_' . $this->identifier)) {
         $page = unserialize($data);
         $page_cached = true;
     } else {
         // No valid cache found (you have to make the page)
         $client = $this->registry->get('cms:client');
         $page = $client->getPage($this->identifier);
         $page = recursive_array_map('utf8_decode', $page);
         $cache->save(serialize($page));
         $page_cached = false;
     }
     if (!empty($page['http_header_status']) and $page['http_header_status'] == 'HTTP/1.0 404 Not Found') {
         throw new k_http_Response(404);
     }
     $html = new IntrafacePublic_CMS_HTML_Parser($page);
     $content = $html->getSection('content');
     $this->document->title = $page['title'];
     $this->document->style = $page['css'];
     $this->document->keywords = $page['keywords'];
     $this->document->description = $page['description'];
     $this->document->navigation = $page['navigation_toplevel'];
     if (!empty($page['navigation_sublevel'])) {
         $this->document->subnavigation = $page['navigation_sublevel'];
     } else {
         $this->document->subnavigation = '';
     }
     if (empty($content['html'])) {
         throw new Exception('no html section in the content');
     }
     return $content['html'];
 }
Пример #2
0
 function renderHtml()
 {
     $page = $this->cms->getPage('frontpage');
     $parser = new IntrafacePublic_CMS_HTML_Parser($page);
     $content = $parser->getSection('content');
     $data = array('content' => $content['elements'][0]['html']);
     $tpl = $this->templates->create('main');
     return $tpl->render($this, $data);
 }
Пример #3
0
 function renderHtml()
 {
     $page = $this->cms->getPage($this->name());
     $navigation = $page['navigation_toplevel'];
     if (!empty($page['http_header_status']) and $page['http_header_status'] == 'HTTP/1.0 404 Not Found') {
         throw new k_PageNotFound();
     }
     $parser = new IntrafacePublic_CMS_HTML_Parser($page);
     $this->document->setTitle($page['title']);
     $this->document->style = $page['css'];
     $this->document->keywords = $page['keywords'];
     $this->document->description = $page['description'];
     $this->document->navigation['html'] = $parser->parseNavigation();
     $this->document->navigation['toplevel'] = $page['navigation_toplevel'];
     if (!empty($page['navigation_sublevel'])) {
         $this->document->navigation['sublevel'] = $page['navigation_sublevel'];
     } else {
         $this->document->navigation['sublevel'] = array();
     }
     $sections = $parser->getSections();
     $headline = $parser->getSection('headline');
     $picture = $parser->getSection('picture');
     $html = $parser->getSection('html');
     $data = array('headline' => $headline['text'], 'html' => $html['html'], 'picture' => $picture['picture']);
     $tpl = $this->template->create('page');
     return $tpl->render($this, $data);
 }