/**
  * Show a specific news article
  *
  * @return void
  */
 public function articleAction()
 {
     $articleID = $this->getRequest()->getParam('articleID');
     $news = new Datasource_Cms_News();
     $article = $news->getArticle($articleID);
     $content = $article['content'];
     // Replace code snippets in the content
     $snippets = new Application_Cms_PageSnippets();
     $content = $snippets->replace($content);
     $this->view->pageTitle = htmlentities(html_entity_decode($article['title'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8');
     $this->view->content = $content;
     $this->view->title = $article['title'];
     $this->view->summary = $article['summary'];
     $this->view->date = $article['niceDate'];
     $this->view->category = 'corporate';
     $this->view->articleId = intval($articleID);
 }
 /**
  * Handles loading and generating a cms controlled page
  *
  * @return void
  */
 public function viewPageAction()
 {
     $cmsPage = new Datasource_Cms_Pages();
     $page = $cmsPage->getByUrl($this->url);
     // Try to work out whether some sub-styling (landlords, tenants, letting-agents) needs to be applied
     $urlSplit = explode('/', $this->url);
     $pageStyling = 'corporate';
     switch ($urlSplit[0]) {
         case 'landlords':
             $pageStyling = 'landlords';
             break;
         case 'tenants':
             $pageStyling = 'tenants';
             break;
         case 'letting-agents':
             $pageStyling = 'letting-agents';
             break;
     }
     if (count($page) > 0) {
         // Valid page in the database so load it's template and pass in the meta and content data
         $content = $this->view->partial('templates/' . $page['template'] . '.phtml', array('meta' => $page['meta'], 'content' => $page['content'], 'pageStyling' => $pageStyling));
         // Replace code snippets in the content
         $snippets = new Application_Cms_PageSnippets();
         $content = $snippets->replace($content);
         $this->view->content = $content;
         $this->view->pageTitle = $page['title'];
         $this->view->description = $page['description'];
         $this->view->keywords = $page['keywords'];
     } else {
         // Throw a 404 error
         throw new Zend_Controller_Action_Exception("This page doesn't exist", 404);
     }
 }