protected function loadUrls() { $this->urls = array_merge(Page::getSitemapUrls(), BlogModel::getSitemapUrls()); }
/** * Prepare the output and tell the template to render. */ public function output() { // Send globals to the template. $template = Template::getInstance(); if (!empty($this->page)) { $template->set('content', $this->page); } $template->set('google_analytics_id', Configuration::get('google_analytics_id')); // TODO: These should be called directly from the template. $template->set('errors', Messenger::getErrors()); $template->set('messages', Messenger::getMessages()); $template->set('site_name', Configuration::get('site.name')); $template->set('blog', Blog::getInstance()); JS::set('active_nav', $this->nav); $template->render($this->template); }
public function get() { $blog_id = Request::get('id', 'int') | Request::get('blog_id', 'int'); $path = explode('/', Request::getLocation()); $blog = BlogModel::getInstance(); if (preg_match('/.*\\.htm/', $path[0])) { $blog->loadContentByURL($path[0]); } elseif ($blog_id) { $blog->loadContentById($blog_id); } elseif (array_shift($path) == 'blog') { if (!empty($path)) { $blog->page = is_numeric($path[count($path) - 1]) ? $path[count($path) - 1] : 1; if ($path[0] == 'category') { // Load category roll $blog->loadList($blog->page, 'category', $path[1]); } elseif ($path[0] == 'author') { // Load an author roll. $blog->loadList($blog->page, 'author', $path[1]); } elseif (!empty($blog->page)) { $blog->loadList(); } else { // Try to load a specific blog. $blog->loadContentByURL($path[0]); } } } if (empty($blog->posts)) { // Fall back, load blogroll $blog->loadList(1); } $template = Template::getInstance(); if (count($blog->posts) == 1) { $template->set('page_section', 'blog'); } else { // If there is more than one, we show a list with short bodies. $blog->shorten_body = true; } if (count($blog->posts) == 1) { foreach (array('title', 'keywords', 'description', 'author') as $meta_data) { switch ($meta_data) { case 'title': $value = $blog->posts[0]['title'] . ' | ' . Configuration::get('meta_data.title') . ' | ' . Scrub::toHTML($blog->body($blog->posts[0]['author_name'], true)); break; case 'description': $value = Scrub::toHTML($blog->body($blog->posts[0]['body'], true)); break; case 'author': $value = Scrub::toHTML($blog->body($blog->posts[0]['author_name'], true)); break; default: $value = Scrub::toHTML($blog->body($blog->posts[0][$meta_data], true)); } $template->set('page_' . $meta_data, $value); } } //meta facebook image if (count($blog->posts) == 1 && !empty($blog->posts[0]['header_image'])) { $template->set('og_image', Configuration::get('web_root') . $blog->posts[0]['header_image']); } elseif ($default_image = Configuration::get('blog.default_image')) { $template->set('og_image', Configuration::get('web_root') . $default_image); } }