Example #1
0
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $page = $this->getPage();
     if ($head = $this->getLayout()->getBlock('head')) {
         $head->setRobots($page->getMetaRobots());
     }
 }
Example #2
0
 protected function _toHtml()
 {
     if ($this->_getCleanPage()->hasContentBlocks()) {
         return $this->_contentBlocksHtml();
     } else {
         return parent::_toHtml();
     }
 }
Example #3
0
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     /** @var Mage_Page_Block_Html_Head $head */
     $head = $this->getLayout()->getBlock('head');
     if ($head) {
         $page = $this->getPage();
         $option = Mage::getSingleton('metarobots/attribute_source_metarobots');
         $head->setRobots($option->getOptionLabel($page->getMetaRobots()));
     }
 }
Example #4
0
 /**
  * Prepare global layout
  *
  * @return Mage_Cms_Block_Page
  */
 protected function _prepareLayout()
 {
     $head = $this->getLayout()->getBlock('head');
     if ($head) {
         if (Mage::helper('catalog/product')->canUseCanonicalTag()) {
             $current_url = preg_replace("/(.*\\.com\\/)(?:.*\\/)(.*\\/)+/i", "\$1\$2", $this->helper('core/url')->getCurrentUrl());
             $head->addLinkRel('canonical', $current_url);
         }
     }
     return parent::_prepareLayout();
 }
Example #5
0
 /**
  * CMS Page cache
  *
  * @param Mage_Cms_Block_Page $block
  */
 public function applyCmsPage(Mage_Cms_Block_Page $block)
 {
     // The "messages" block is session-dependent, don't cache
     if (Mage::helper('cache')->responseHasMessages()) {
         $block->setData('cache_lifetime', null);
         return;
     }
     // Set cache tags
     $tags = $block->getCacheTags();
     $tags[] = Mage_Cms_Model_Page::CACHE_TAG . '_' . $block->getPage()->getId();
     $block->setData('cache_tags', $tags);
     // Set cache keys
     $keys = $block->getCacheKeys();
     $keys[] = $block->getPage()->getId();
     $keys[] = $block->getLayout()->getUpdate()->getCacheId();
     $block->setData('cache_keys', $keys);
 }
Example #6
0
 /**
  * @return string
  */
 protected function _toHtml()
 {
     /* @var RK_TypeCMS_Model_Page $page */
     $page = Mage::getModel('typecms/page')->load($this->getPage()->getId());
     if ($page->getId()) {
         $blockType = $page->getPageTypeInstance()->getBlock();
         $block = $this->getLayout()->createBlock($blockType, 'typecms_block');
         $block->setTemplate($page->getPageTypeInstance()->getTemplate());
         $block->addData($page->getFilteredData());
         $block->addData($this->getPage()->getData());
         $block->setPage($this->getPage());
         return $block->toHtml();
     }
     return parent::_toHtml();
 }
Example #7
0
 protected function _prepareLayout()
 {
     $page = $this->getPage();
     // show breadcrumbs
     if (Mage::getStoreConfig('web/default/show_cms_breadcrumbs') && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) && $page->getIdentifier() !== Mage::getStoreConfig('web/default/cms_home_page') && $page->getIdentifier() !== Mage::getStoreConfig('web/default/cms_no_route')) {
         $breadcrumbs->addCrumb('home', array('label' => Mage::helper('cms')->__('Home'), 'title' => Mage::helper('cms')->__('Go to Home Page'), 'link' => Mage::getBaseUrl()));
         $breadcrumbs->addCrumb('cms_page', array('label' => $page->getTitle(), 'title' => $page->getTitle()));
     }
     $root = $this->getLayout()->getBlock('root');
     if ($root) {
         $root->addBodyClass('cms-' . $page->getIdentifier());
     }
     $head = $this->getLayout()->getBlock('head');
     if ($head) {
         $head->setTitle($page->getTitle());
         $head->setKeywords($page->getMetaKeywords());
         $head->setDescription($page->getMetaDescription());
         $head->setRobots($page->getMetaRobots());
     }
     return parent::_prepareLayout();
 }
Example #8
0
 /**
  * Collects list of objects in product list
  *
  * @param Mage_Cms_Block_Page $object
  * @return Mage_Cms_Model_Page[]
  */
 public function collect($object)
 {
     return array($object->getPage());
 }