我有一个在Magento中创建页面的模块。由于我无法在CMS页面中复制模块的功能,因此我想转换模块以生成使用CMS模型进行页面输出的页面。我正在寻找控制器,这个代码看起来很有希望,但我不确定我会改变什么。任何人都可以帮助我吗?
// Setup layout handles
$this->getLayout()->getUpdate()
->addHandle('default')
->addHandle('custompage_map');
$this->addActionLayoutHandles();
$this->loadLayoutUpdates();
$this->generateLayoutXml()->generateLayoutBlocks();
foreach (array('catalog/session', 'checkout/session') as $class_name) {
$storage = Mage::getSingleton($class_name);
if ($storage) {
$this->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
}
}
// Render our layout
$this->renderLayout();
}
答案 0 :(得分:0)
看看@
/app/code/core/Mage/Cms/controllers/IndexController.php
用
替换您的控制器方法public function noRouteAction($coreRoute = null)
{
$pageId = {cms page key};
if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
$this->_forward('defaultNoRoute');
}
}