Public Member Functions | |
renderPage (Mage_Core_Controller_Front_Action $action, $pageId=null) | |
getPageUrl ($pageId=null) | |
Public Attributes | |
const | XML_PATH_NO_ROUTE_PAGE = 'web/default/cms_no_route' |
const | XML_PATH_NO_COOKIES_PAGE = 'web/default/cms_no_cookies' |
const | XML_PATH_HOME_PAGE = 'web/default/cms_home_page' |
Definition at line 35 of file Page.php.
getPageUrl | ( | $ | pageId = null |
) |
Retrieve page direct URL
string | $pageId |
Definition at line 111 of file Page.php.
00112 { 00113 $page = Mage::getSingleton('cms/page'); 00114 if (!is_null($pageId) && $pageId !== $page->getId()) { 00115 $page->setStoreId(Mage::app()->getStore()->getId()); 00116 if (!$page->load($pageId)) { 00117 return null; 00118 } 00119 } 00120 00121 if (!$page->getId()) { 00122 return null; 00123 } 00124 00125 return Mage::getUrl(null, array('_direct' => $page->getIdentifier())); 00126 }
renderPage | ( | Mage_Core_Controller_Front_Action $ | action, | |
$ | pageId = null | |||
) |
Renders CMS page
Call from controller action
Mage_Core_Controller_Front_Action | $action | |
integer | $pageId |
Definition at line 50 of file Page.php.
00051 { 00052 $page = Mage::getSingleton('cms/page'); 00053 if (!is_null($pageId) && $pageId!==$page->getId()) { 00054 $page->setStoreId(Mage::app()->getStore()->getId()); 00055 if (!$page->load($pageId)) { 00056 return false; 00057 } 00058 } 00059 00060 if (!$page->getId()) { 00061 return false; 00062 } 00063 00064 if ($page->getCustomTheme()) { 00065 if (Mage::app()->getLocale()->IsStoreDateInInterval(null, $page->getCustomThemeFrom(), $page->getCustomThemeTo())) { 00066 list($package, $theme) = explode('/', $page->getCustomTheme()); 00067 Mage::getSingleton('core/design_package') 00068 ->setPackageName($package) 00069 ->setTheme($theme); 00070 } 00071 } 00072 00073 $action->getLayout()->getUpdate() 00074 ->addHandle('default') 00075 ->addHandle('cms_page'); 00076 00077 $action->addActionLayoutHandles(); 00078 if ($page->getRootTemplate()) { 00079 $action->getLayout()->helper('page/layout') 00080 ->applyHandle($page->getRootTemplate()); 00081 } 00082 00083 $action->loadLayoutUpdates(); 00084 $action->getLayout()->getUpdate()->addUpdate($page->getLayoutUpdateXml()); 00085 $action->generateLayoutXml()->generateLayoutBlocks(); 00086 00087 if ($page->getRootTemplate()) { 00088 $action->getLayout()->helper('page/layout') 00089 ->applyTemplate($page->getRootTemplate()); 00090 } 00091 00092 if ($storage = Mage::getSingleton('catalog/session')) { 00093 $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true)); 00094 } 00095 00096 if ($storage = Mage::getSingleton('checkout/session')) { 00097 $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true)); 00098 } 00099 00100 $action->renderLayout(); 00101 00102 return true; 00103 }
const XML_PATH_HOME_PAGE = 'web/default/cms_home_page' |
const XML_PATH_NO_COOKIES_PAGE = 'web/default/cms_no_cookies' |
const XML_PATH_NO_ROUTE_PAGE = 'web/default/cms_no_route' |