00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Cms_Block_Page extends Mage_Core_Block_Abstract
00035 {
00036 public function getPage()
00037 {
00038 if (!$this->hasData('page')) {
00039 if ($this->getPageId()) {
00040 $page = Mage::getModel('cms/page')
00041 ->setStoreId(Mage::app()->getStore()->getId())
00042 ->load($this->getPageId(), 'identifier');
00043 } else {
00044 $page = Mage::getSingleton('cms/page');
00045 }
00046 $this->setData('page', $page);
00047 }
00048 return $this->getData('page');
00049 }
00050
00051 protected function _prepareLayout()
00052 {
00053 $page = $this->getPage();
00054
00055
00056 if (Mage::getStoreConfig('web/default/show_cms_breadcrumbs')
00057 && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))
00058 && ($page->getIdentifier()!==Mage::getStoreConfig('web/default/cms_home_page'))
00059 && ($page->getIdentifier()!==Mage::getStoreConfig('web/default/cms_no_route'))) {
00060 $breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Go to Home Page'), 'link'=>Mage::getBaseUrl()));
00061 $breadcrumbs->addCrumb('cms_page', array('label'=>$page->getTitle(), 'title'=>$page->getTitle()));
00062 }
00063
00064 if ($root = $this->getLayout()->getBlock('root')) {
00065 $root->addBodyClass('cms-'.$page->getIdentifier());
00066 }
00067
00068 if ($head = $this->getLayout()->getBlock('head')) {
00069 $head->setTitle($page->getTitle());
00070 $head->setKeywords($page->getMetaKeywords());
00071 $head->setDescription($page->getMetaDescription());
00072 }
00073 }
00074
00075 protected function _toHtml()
00076 {
00077 $processor = Mage::getModel('core/email_template_filter');
00078 $html = $processor->filter($this->getPage()->getContent());
00079 $html = $this->getMessagesBlock()->getGroupedHtml() . $html;
00080 return $html;
00081 }
00082 }