예제 #1
0
 /**
  * Stores content as view script in cache and renders it
  * 
  * @param Cms_Model_Page $page
  */
 protected function _renderPageAsView(Cms_Model_Page $page)
 {
     $cacheId = HCMS_Controller_Action_Cms_Page::CMS_PAGE_CACHE_PRE . $page->get_id();
     $resources = Zend_Controller_Front::getInstance()->getParam("bootstrap")->getOption('resources');
     $cacheDir = $resources['cachemanager']['core']['backend']['options']['cache_dir'];
     $cacheFileName = 'zend_cache---' . $cacheId;
     // Create Zend_Cache_Core object
     $cache = HCMS_Cache::getInstance()->getCoreCache();
     // If no cache available for this content page
     if (!$cache->test($cacheId)) {
         $cache->save((string) $page->get_content(), $cacheId);
         //forcing raw string :(
         file_put_contents($cacheDir . "/" . $cacheFileName, $page->get_content());
     }
     $this->view->addScriptPath($cacheDir);
     return $this->view->render($cacheFileName);
 }
예제 #2
0
 /**
  * Populate feed entry data
  * 
  * @param Cms_Model_Page $page
  * @param Zend_Feed_Entry_Abstract $entry
  */
 protected function _populateFeedEntry(Cms_Model_Page $page, Zend_Feed_Writer_Entry $entry)
 {
     $entry->setTitle($page->get_title());
     $entry->setLink($this->view->serverUrl() . $this->view->url(array('module' => $this->getRequest()->getModuleName(), 'controller' => $this->getRequest()->getControllerName(), 'action' => 'index', 'url_id' => $page->get_url_id()), 'cms'));
     if (null != $page->get_user_name() && '' != $page->get_user_name()) {
         $entry->addAuthor(array('name' => $page->get_user_name()));
     }
     $entry->setDateModified(new Zend_Date($page->get_posted(), Zend_Date::ISO_8601));
     if (null != $page->get_teaser() && '' != $page->get_teaser()) {
         $entry->setDescription($page->get_teaser());
     }
     $entry->setContent($this->_fixRelImagePaths($page->get_content()));
 }